-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Halliday
committed
Nov 25, 2012
1 parent
463afd2
commit ddd2535
Showing
4 changed files
with
86 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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(function (q) { | ||
q.plan(2); | ||
q.ok(true); | ||
|
||
setTimeout(function () { | ||
q.ok(true); | ||
}, 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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters