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, 'inside ok');
|
22 |
|
23 | setTimeout(function () {
|
24 | q.ok(true, 'inside delayed');
|
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 | });
|