Revision: 3442 http://vexi.svn.sourceforge.net/vexi/?rev=3442&view=rev Author: mkpg2 Date: 2009-03-24 04:22:22 +0000 (Tue, 24 Mar 2009)
Log Message: ----------- Added assertion methods, assertExceptionThrown(), assertObjectEquals() Modified Paths: -------------- trunk/widgets/org.vexi.vunit/src/vexi/test/vunit.t Modified: trunk/widgets/org.vexi.vunit/src/vexi/test/vunit.t =================================================================== --- trunk/widgets/org.vexi.vunit/src/vexi/test/vunit.t 2009-03-24 03:47:51 UTC (rev 3441) +++ trunk/widgets/org.vexi.vunit/src/vexi/test/vunit.t 2009-03-24 04:22:22 UTC (rev 3442) @@ -208,7 +208,7 @@ static.assertNotNull = function(actual) { if (null == actual) { - throw "!= null assertion failed"; + throw "got null, expected not null"; } } @@ -273,6 +273,14 @@ "Actual: " + actual + " (" + typeof(actual) + ")"; } } + + static.assertObjectEquals = function(exp, actual) { + // TODO - implement a proprer comparison function + assertEquals( + vexi.js.stringify(exp), + vexi.js.stringify(actual)); + } + //aliases static.assertEq = assertEquals; @@ -281,8 +289,15 @@ static.assertLT = assertLessThan; static.assertLTE = assertLessThanEquals; + static.assertExceptionThrown = function(f){ + try{ + f(); + }catch(e){ + return e; + } + throw "expected exception"; + }; - ///////// // ASYNC assertion stuff /* If you want to assert in a different thread to that of the test was This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn