Revision: 3449
          http://vexi.svn.sourceforge.net/vexi/?rev=3449&view=rev
Author:   mkpg2
Date:     2009-03-26 02:57:48 +0000 (Thu, 26 Mar 2009)

Log Message:
-----------
Fix. Display file name as test name when available.

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-25 23:28:47 UTC 
(rev 3448)
+++ trunk/widgets/org.vexi.vunit/src/vexi/test/vunit.t  2009-03-26 02:57:48 UTC 
(rev 3449)
@@ -49,8 +49,10 @@
        // with functions(tests) using the naming convention
        // testxxx. Where xxx will be the name of the test.
        // obj.name is the name of the suite.
-       var newQuickSuite = function(obj){
-               var suitename = obj.name?obj.name:obj;
+       var newQuickSuite = function(obj,name){
+               var suitename = obj.name?obj.name
+                                                  :name?name
+                                                  :"unnamed";
                var r = newTestSuite(suitename);
                var v;
                for(v in obj){
@@ -63,23 +65,23 @@
                return r;
        };
        
-       var formTest = function(test){
+       var formTest = function(test,name){
         try{ 
             var objtype = typeof(test);
             if(objtype == "object"){
                    // check if already an 'internal' test object
                    if(test.nbtests != null || test.run != null) return test;
-                   return newQuickSuite(test);
+                   return newQuickSuite(test,name);
                // TBD remove =="stream"  
                }else if(objtype=="blessing" || objtype=="stream"){
-                   var name = (""+test).split("$")[0];
+                   name = (""+test).split("$")[0];
                    var secs = name.split("\.");
                    name = secs[secs.length-1];
                    var templateStatic = test[""];
                    if(templateStatic!=null){ // template
                        var t = (templateStatic.test==null)
-                          ? formTest( function(){test(vexi.box);})
-                          : formTest(test[""].test);
+                          ? formTest( function(){test(vexi.box);},name)
+                          : formTest(test[""].test,name);
                        if(!t.name) t.name = name;
                        return t;
                    }else{ // directory
@@ -93,7 +95,7 @@
                        return r; 
                    }
                }else if(objtype=="function"){
-                       return newTestCase(null,test);
+                       return newTestCase(name,test);
                }
                throw "Not a valid test " + test;
         }catch(e){


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

------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to