Added some tests

This commit is contained in:
2021-06-23 22:30:45 +02:00
parent 24f897e907
commit 3d3d7fae48
3796 changed files with 218744 additions and 3 deletions

37
tests/node_modules/tape/test/exit/fail.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
'use strict';
var test = require('../../');
var falafel = require('falafel');
test('array', function (t) {
t.plan(5);
var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
} + ')()';
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]);
}
);
});

12
tests/node_modules/tape/test/exit/missing_end.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
'use strict';
var test = require('../../');
test('first', function (t) {
t.ok(true);
t.end();
});
test('oops forgot end', function (t) {
t.ok(true);
});

38
tests/node_modules/tape/test/exit/ok.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use strict';
var falafel = require('falafel');
var test = require('../../');
test('array', function (t) {
t.comment('hi');
t.plan(5);
var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
} + ')()';
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});

13
tests/node_modules/tape/test/exit/second.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
'use strict';
var test = require('../../');
test('first', function (t) {
t.plan(1);
t.ok(true);
});
test('second', function (t) {
t.plan(2);
t.ok(true);
});

8
tests/node_modules/tape/test/exit/todo.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict';
var test = require('../../');
test('todo pass', { todo: true }, function (t) {
t.plan(1);
t.ok(true);
});

8
tests/node_modules/tape/test/exit/todo_fail.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict';
var test = require('../../');
test('todo fail', { todo: true }, function (t) {
t.plan(1);
t.ok(false);
});

37
tests/node_modules/tape/test/exit/too_few.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
'use strict';
var falafel = require('falafel');
var test = require('../../');
test('array', function (t) {
t.plan(6);
var src = '(' + function () {
var xs = [ 1, 2, [ 3, 4 ] ];
var ys = [ 5, 6 ];
g([ xs, ys ]);
} + ')()';
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
node.update('fn(' + node.source() + ')');
}
});
var arrays = [
[ 3, 4 ],
[ 1, 2, [ 3, 4 ] ],
[ 5, 6 ],
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]
];
Function(['fn','g'], output)(
function (xs) {
t.same(arrays.shift(), xs);
return xs;
},
function (xs) {
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
}
);
});