Revision: 3394
          http://vexi.svn.sourceforge.net/vexi/?rev=3394&view=rev
Author:   mkpg2
Date:     2009-02-19 23:16:23 +0000 (Thu, 19 Feb 2009)

Log Message:
-----------
Improve ways of specifying different tests.

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-02-19 04:42:56 UTC 
(rev 3393)
+++ trunk/widgets/org.vexi.vunit/src/vexi/test/vunit.t  2009-02-19 23:16:23 UTC 
(rev 3394)
@@ -3,20 +3,7 @@
    <meta:doc>
       Author: Mike
       <usage>
-          Framework for
-          1. Creating tests
-              a. newTestSuite
-             b. newTestCase
-             c. Automatic 
-                 - templates -> suites
-                  - objects -> suites 
-                  - functions -> tests
-          2. Running Tests
-              *Should be used in conjunction with a test
-              listener to display the test results
-          3. Assertion
-              - synchronous and asynchronous        
-       
+          See the wiki page http://vexi.sourceforge.net/VUnit      
       </usage>
    </meta:doc>
 
@@ -86,11 +73,14 @@
                    var name = (""+test).split("$")[0];
                    var secs = name.split("\.");
                    name = secs[secs.length-1];
-                   if(test[""]!=null and test[""].test!=null){
-                       var t = test[""].test;
+                   var templateStatic = test[""];
+                   if(templateStatic!=null){ // template
+                       var t = (templateStatic.test==null)
+                          ? formTest( function(){test(vexi.box);})
+                          : formTest(test[""].test);
                        if(!t.name) t.name = name;
-                       return formTest(t);
-                   }else{
+                       return t;
+                   }else{ // directory
                        var r = newTestSuite(name);
                        // Add all sub directories
                        for(var k in test){
@@ -100,7 +90,10 @@
                        }
                        return r; 
                    }
+               }else if(typeof(test)=="function"){
+                       return newTestCase(null,test);
                }
+               throw "Not a valid test " + test;
         }catch(e){
             return newTestCase("couldn't create test", 
                            function(){throw e;});
@@ -121,9 +114,9 @@
                // Yield to make sure viewer can execute
                vexi.thread.yield();
        
-               
                // START TEST
                test = formTest(test);
+               
                if(testListener)testListener.startTest(test);
                depth++;
                if(test.nbtests!=null){


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to