diff --git a/test/driver.js b/test/driver.js index f6d35a1d6c..d56f3b551b 100644 --- a/test/driver.js +++ b/test/driver.js @@ -32,10 +32,8 @@ try { comments = []; var testOpts = test.options || opts; - var oldOnComment = testOpts.onComment; - if (!oldOnComment) testOpts.onComment = onComment; + testOpts.onComment = onComment; var ast = parse(test.code, testOpts); - testOpts.onComment = oldOnComment; if (test.error) { if (config.loose) { callback("ok", test.code); diff --git a/test/tests.js b/test/tests.js index 287d98f84d..8d17a891a4 100644 --- a/test/tests.js +++ b/test/tests.js @@ -28666,55 +28666,35 @@ testFail("for(x of a);", "Unexpected token (1:6)"); testFail("for(var x of a);", "Unexpected token (1:10)"); // Assertion Tests -(function() { - var actualComments = [], - expectedComments = [ - " Bear class", - " Whatever", - [" 1", - " 2", - " 3" - ].join('\n'), - "stuff" - ]; - testAssert( - function TestComments() { - // Bear class - function Bear(x,y,z) { - this.position = [x||0,y||0,z||0] - } - - Bear.prototype.roar = function(message) { - return 'RAWWW: ' + message; // Whatever - }; - - function Cat() { - /* 1 - 2 - 3*/ - } - - Cat.prototype.roar = function(message) { - return 'MEOOWW: ' + /*stuff*/ message; - }; - }.toString().replace(/\r\n/g, '\n'), - function assert(ast) { - if (actualComments.length !== expectedComments.length) { - return JSON.stringify(actualComments) + " !== " + JSON.stringify(expectedComments); - } else { - for (var i=0, n=actualComments.length; i < n; i++) { - if (actualComments[i] !== expectedComments[i]) - return JSON.stringify(actualComments[i]) + ' !== ' + JSON.stringify(expectedComments[i]); - } - } - }, - { - onComment: function(isMultiline, text) { - actualComments.push(text); - } +test(function TestComments() { + // Bear class + function Bear(x,y,z) { + this.position = [x||0,y||0,z||0] } - ); -})(); + + Bear.prototype.roar = function(message) { + return 'RAWWW: ' + message; // Whatever + }; + + function Cat() { + /* 1 + 2 + 3*/ + } + + Cat.prototype.roar = function(message) { + return 'MEOOWW: ' + /*stuff*/ message; + }; +}.toString().replace(/\r\n/g, '\n'), {}, {}, [ + {block: false, text: " Bear class"}, + {block: false, text: " Whatever"}, + {block: true, text: [ + " 1", + " 2", + " 3" + ].join('\n')}, + {block: true, text: "stuff"} +]); test("