Added some tests
This commit is contained in:
37
tests/node_modules/tape/example/array.js
generated
vendored
Normal file
37
tests/node_modules/tape/example/array.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var falafel = require('falafel');
|
||||
var test = require('../');
|
||||
|
||||
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, 4 ] ], [ 5, 6 ] ]);
|
||||
}
|
||||
);
|
||||
});
|
||||
37
tests/node_modules/tape/example/fail.js
generated
vendored
Normal file
37
tests/node_modules/tape/example/fail.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var falafel = require('falafel');
|
||||
var test = require('../');
|
||||
|
||||
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 ] ]);
|
||||
}
|
||||
);
|
||||
});
|
||||
53
tests/node_modules/tape/example/nested.js
generated
vendored
Normal file
53
tests/node_modules/tape/example/nested.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var falafel = require('falafel');
|
||||
var test = require('../');
|
||||
|
||||
test('nested array test', 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() + ')');
|
||||
}
|
||||
});
|
||||
|
||||
t.test('inside test', function (q) {
|
||||
q.plan(2);
|
||||
q.ok(true, 'inside ok');
|
||||
|
||||
setTimeout(function () {
|
||||
q.ok(true, 'inside delayed');
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
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]]);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
test('another', function (t) {
|
||||
t.plan(1);
|
||||
setTimeout(function () {
|
||||
t.ok(true);
|
||||
}, 100);
|
||||
});
|
||||
53
tests/node_modules/tape/example/nested_fail.js
generated
vendored
Normal file
53
tests/node_modules/tape/example/nested_fail.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
var falafel = require('falafel');
|
||||
var test = require('../');
|
||||
|
||||
test('nested array test', 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() + ')');
|
||||
}
|
||||
});
|
||||
|
||||
t.test('inside test', function (q) {
|
||||
q.plan(2);
|
||||
q.ok(true);
|
||||
|
||||
setTimeout(function () {
|
||||
q.equal(3, 4);
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
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 ] ]);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
test('another', function (t) {
|
||||
t.plan(1);
|
||||
setTimeout(function () {
|
||||
t.ok(true);
|
||||
}, 100);
|
||||
});
|
||||
5
tests/node_modules/tape/example/no_callback.js
generated
vendored
Normal file
5
tests/node_modules/tape/example/no_callback.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../');
|
||||
|
||||
test('No cb test');
|
||||
37
tests/node_modules/tape/example/not_enough_fail.js
generated
vendored
Normal file
37
tests/node_modules/tape/example/not_enough_fail.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var falafel = require('falafel');
|
||||
var test = require('../');
|
||||
|
||||
test('array', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
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]]);
|
||||
}
|
||||
);
|
||||
});
|
||||
2
tests/node_modules/tape/example/static/build.sh
generated
vendored
Executable file
2
tests/node_modules/tape/example/static/build.sh
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
browserify ../timing.js -o bundle.js
|
||||
21
tests/node_modules/tape/example/static/index.html
generated
vendored
Normal file
21
tests/node_modules/tape/example/static/index.html
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
if (typeof console === 'undefined') console = {};
|
||||
console.log = function (msg) {
|
||||
var txt = document.createTextNode(msg);
|
||||
document.body.appendChild(txt);
|
||||
};
|
||||
</script>
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
6
tests/node_modules/tape/example/static/server.js
generated
vendored
Normal file
6
tests/node_modules/tape/example/static/server.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var http = require('http');
|
||||
var ecstatic = require('ecstatic')(__dirname);
|
||||
var server = http.createServer(ecstatic);
|
||||
server.listen(8000);
|
||||
12
tests/node_modules/tape/example/stream/object.js
generated
vendored
Normal file
12
tests/node_modules/tape/example/stream/object.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../../');
|
||||
var path = require('path');
|
||||
|
||||
test.createStream({ objectMode: true }).on('data', function (row) {
|
||||
console.log(JSON.stringify(row));
|
||||
});
|
||||
|
||||
process.argv.slice(2).forEach(function (file) {
|
||||
require(path.resolve(file));
|
||||
});
|
||||
10
tests/node_modules/tape/example/stream/tap.js
generated
vendored
Normal file
10
tests/node_modules/tape/example/stream/tap.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../../');
|
||||
var path = require('path');
|
||||
|
||||
test.createStream().pipe(process.stdout);
|
||||
|
||||
process.argv.slice(2).forEach(function (file) {
|
||||
require(path.resolve(file));
|
||||
});
|
||||
7
tests/node_modules/tape/example/stream/test/x_fail.js
generated
vendored
Normal file
7
tests/node_modules/tape/example/stream/test/x_fail.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../../../');
|
||||
test(function (t) {
|
||||
t.plan(1);
|
||||
t.equal('beep', 'boop');
|
||||
});
|
||||
13
tests/node_modules/tape/example/stream/test/y.js
generated
vendored
Normal file
13
tests/node_modules/tape/example/stream/test/y.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../../../');
|
||||
test(function (t) {
|
||||
t.plan(2);
|
||||
t.equal(1 + 1, 2);
|
||||
t.ok(true);
|
||||
});
|
||||
|
||||
test('wheee', function (t) {
|
||||
t.ok(true);
|
||||
t.end();
|
||||
});
|
||||
11
tests/node_modules/tape/example/throw.js
generated
vendored
Normal file
11
tests/node_modules/tape/example/throw.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../');
|
||||
|
||||
test('throw', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
setTimeout(function () {
|
||||
throw new Error('doom');
|
||||
}, 100);
|
||||
});
|
||||
14
tests/node_modules/tape/example/timing.js
generated
vendored
Normal file
14
tests/node_modules/tape/example/timing.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../');
|
||||
|
||||
test('timing test', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
t.equal(typeof Date.now, 'function');
|
||||
var start = Date.now();
|
||||
|
||||
setTimeout(function () {
|
||||
t.ok(Date.now() - start > 100);
|
||||
}, 100);
|
||||
});
|
||||
37
tests/node_modules/tape/example/too_many_fail.js
generated
vendored
Normal file
37
tests/node_modules/tape/example/too_many_fail.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var falafel = require('falafel');
|
||||
var test = require('../');
|
||||
|
||||
test('array', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
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 ] ]);
|
||||
}
|
||||
);
|
||||
});
|
||||
20
tests/node_modules/tape/example/two.js
generated
vendored
Normal file
20
tests/node_modules/tape/example/two.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('../');
|
||||
|
||||
test('one', function (t) {
|
||||
t.plan(2);
|
||||
t.ok(true);
|
||||
setTimeout(function () {
|
||||
t.equal(1+3, 4);
|
||||
}, 100);
|
||||
});
|
||||
|
||||
test('two', function (t) {
|
||||
t.plan(3);
|
||||
t.equal(5, 2+3);
|
||||
setTimeout(function () {
|
||||
t.equal('a'.charCodeAt(0), 97);
|
||||
t.ok(true);
|
||||
}, 50);
|
||||
});
|
||||
Reference in New Issue
Block a user