Skip to content

Commit 1ea9057

Browse files
author
James Halliday
committedNov 25, 2012
nested failure example
1 parent dab1314 commit 1ea9057

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
 

‎example/nested_fail.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
var falafel = require('falafel');
2+
var test = require('../');
3+
4+
test('nested array test', function (t) {
5+
t.plan(5);
6+
7+
var src = '(' + function () {
8+
var xs = [ 1, 2, [ 3, 4 ] ];
9+
var ys = [ 5, 6 ];
10+
g([ xs, ys ]);
11+
} + ')()';
12+
13+
var output = falafel(src, function (node) {
14+
if (node.type === 'ArrayExpression') {
15+
node.update('fn(' + node.source() + ')');
16+
}
17+
});
18+
19+
t.test('inside test', function (q) {
20+
q.plan(2);
21+
q.ok(true);
22+
23+
setTimeout(function () {
24+
q.equal(3, 4);
25+
}, 3000);
26+
});
27+
28+
var arrays = [
29+
[ 3, 4 ],
30+
[ 1, 2, [ 3, 4 ] ],
31+
[ 5, 6 ],
32+
[ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ],
33+
];
34+
35+
Function(['fn','g'], output)(
36+
function (xs) {
37+
t.same(arrays.shift(), xs);
38+
return xs;
39+
},
40+
function (xs) {
41+
t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]);
42+
}
43+
);
44+
});
45+
46+
test('another', function (t) {
47+
t.plan(1);
48+
setTimeout(function () {
49+
t.ok(true);
50+
}, 100);
51+
});

0 commit comments

Comments
 (0)
Please sign in to comment.