Ticket #4651: doh_runner.diff

File doh_runner.diff, 0.9 kB (added by wolfram, 14 months ago)

doh enabled to run DocTests?

  • doh/runner.js

     
    499499        this.registerTest(groupOrNs, testOrNull); 
    500500} 
    501501 
     502dojo.require("dojox.testing.DocTest"); 
     503doh.registerDocTests = function(module) { 
     504        //      summary: 
     505        //              Get all the doctests from the given module and register each of them 
     506        //              as a single test case here. 
     507        // 
     508         
     509        var docTest = new dojox.testing.DocTest(); 
     510        var docTests = docTest.getTests(module); 
     511        var len = docTests.length; 
     512        var tests = []; 
     513        for (var i=0; i<len; i++) { 
     514                var test = docTests[i]; 
     515                tests.push({ 
     516                        runTest:function(t) { 
     517                                var r = docTest.runTest(test.commands, test.expectedResult); 
     518                                t.assertTrue(r.success); 
     519                        }, 
     520                        name:"test"+(i+1)+", Line "+test.line 
     521                } 
     522                ); 
     523        } 
     524console.log(tests); 
     525        this.register("DocTests: "+module, tests); 
     526} 
     527 
    502528// 
    503529// Assertions and In-Test Utilities 
    504530//