[Pkg-javascript-commits] [node-acorn-jsx] 319/484: Removed manual `onComment` test in favor of new argument.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit 6d6483435235e3c73cf507d7f66f1a454b6c71d8
Author: Ingvar Stepanyan <me at rreverser.com>
Date: Sun Oct 26 20:32:49 2014 +0200
Removed manual `onComment` test in favor of new argument.
---
test/driver.js | 4 +--
test/tests.js | 78 ++++++++++++++++++++++------------------------------------
2 files changed, 30 insertions(+), 52 deletions(-)
diff --git a/test/driver.js b/test/driver.js
index f6d35a1..d56f3b5 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 287d98f..8d17a89 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("<!--\n;", {
type: "Program",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list