Revision: 3778 http://vexi.svn.sourceforge.net/vexi/?rev=3778&view=rev Author: mkpg2 Date: 2010-01-15 18:28:57 +0000 (Fri, 15 Jan 2010)
Log Message: ----------- Tests. Complete/tidy up varargs tests. Modified Paths: -------------- trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs.js Removed Paths: ------------- trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs_yield.js Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java =================================================================== --- trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java 2010-01-15 18:18:53 UTC (rev 3777) +++ trunk/core/org.ibex.js/src_junit/test/js/exec/general/TestGeneral.java 2010-01-15 18:28:57 UTC (rev 3778) @@ -15,7 +15,7 @@ public static void main(String[] args) throws Throwable { try{ JSTestSuite jts = new JSTestSuite(TestGeneral.class); - JSTestCase t = jts.createTestCase(jts.getResourceDirs(), "keysof.js"); + JSTestCase t = jts.createTestCase(jts.getResourceDirs(), "varargs.js"); //t.printByteCode(); t.runBare(); }catch(Throwable t){ Modified: trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs.js =================================================================== --- trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs.js 2010-01-15 18:18:53 UTC (rev 3777) +++ trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs.js 2010-01-15 18:28:57 UTC (rev 3778) @@ -1,10 +1,36 @@ -var f = function(){ - return arguments.length; -}; +// simple +{ + var f = function(){ + return arguments.length; + }; + + assert(3==f.apply(null,[1,2,3]));; +} -var x = f.apply(null,[1,2,3]); -sys.log.info(x); +// yield +{ + // There was a flaw in the apply implementation that you could not yield + // after it had been called. + var f = function(){ + sys.yield(); + return arguments.length; + }; + + assert(0==f()); + assert(3==f.apply(null,[1,2,3])); +} +// use arguments object as input instead or plain old array +{ + var f = function(){ + return arguments.length; + }; + + var g = function(){ + return f.apply(null,arguments); + }; + assert(3==g(1,2,3)); +} Deleted: trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs_yield.js =================================================================== --- trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs_yield.js 2010-01-15 18:18:53 UTC (rev 3777) +++ trunk/core/org.ibex.js/src_junit/test/js/exec/general/varargs_yield.js 2010-01-15 18:28:57 UTC (rev 3778) @@ -1,14 +0,0 @@ -// There was a flaw in the apply implementation that you could not yield -// after it had been called. -var f = function(){ - sys.yield(); - return arguments.length; -}; - -var l1 = f(); -assert(l1==0); -var l2 = f.apply(null,[1,2,3]); -assert(l2==3); - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn