CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/22 17:50:25
Modified files: . : ChangeLog testsuite/misc-mtasc.all: exception.as Log message: * testsuite/misc-mtasc.all/exception.as: more tests for try/catch/finally. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4070&r2=1.4071 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-mtasc.all/exception.as?cvsroot=gnash&r1=1.2&r2=1.3 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4070 retrieving revision 1.4071 diff -u -b -r1.4070 -r1.4071 --- ChangeLog 22 Aug 2007 17:32:44 -0000 1.4070 +++ ChangeLog 22 Aug 2007 17:50:25 -0000 1.4071 @@ -1,3 +1,8 @@ +2007-08-23 Sandro Santilli <[EMAIL PROTECTED]> + + * testsuite/misc-mtasc.all/exception.as: more tests for + try/catch/finally. + 2007-08-22 Sandro Santilli <[EMAIL PROTECTED]> * server/swf.h: add version and reference url to Index: testsuite/misc-mtasc.all/exception.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-mtasc.all/exception.as,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- testsuite/misc-mtasc.all/exception.as 22 Aug 2007 17:32:45 -0000 1.2 +++ testsuite/misc-mtasc.all/exception.as 22 Aug 2007 17:50:25 -0000 1.3 @@ -44,6 +44,47 @@ } } + function throwAndCatchAddingOne(o) + { + try { + throw 'catch'; + return 'try'; + } + catch (e) { + return e; + } + finally { + o.num += 1; + } + } + + function throwFromCatchAddingOne(o) + { + try { + throw 'catch'; + return 'try'; + } + catch (e) { + o.num += 1; + note("Catch inside, throwing again (not expected to survive after finally)!"); + throw e; // double throw not supported ? + return 'catch'; + } + finally { + return 'finally'; + } + } + + function throwNested(o) + { + try { + throw 'throw'; + } catch (e) { + note("Catch inside, throwing again!"); + throw e; + } + } + function test_all() { var res = 'string'; @@ -86,6 +127,36 @@ var ret = addOneOnFinal(o); xcheck_equals(ret, 'finally'); xcheck_equals(o.num, 2); + + ret = throwAndCatchAddingOne(o); + xcheck_equals(ret, 'catch'); + xcheck_equals(o.num, 3); + + try { + ret = throwAndCatchAddingOne(o); + } catch (e) { + ret = 'catch_outside'; + } + xcheck_equals(ret, 'catch'); + xcheck_equals(o.num, 4); + + try { + ret = throwFromCatchAddingOne(o); + } catch (e) { + note("Catch outside"); + o.num += 1; + ret += e+'_outside'; + } + xcheck_equals(ret, 'finally'); + xcheck_equals(o.num, 5); + + try { + throwNested(); + } catch (e) { + note("Catch outside"); + o.num = e; + } + xcheck_equals(o.num, 'throw'); } static function main(mc) _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit