Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

hack around ff array literal normalization in toString in the parente…

… test
  • Loading branch information...
commit 0c632eeb5b9a1b6c7e4b6422cf435464d88d9749 1 parent 0da1483
@substack authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 test/parent.js
View
14 test/parent.js
@@ -12,12 +12,22 @@ test('parent', function (t) {
var output = falafel(src, function (node) {
if (node.type === 'ArrayExpression') {
t.equal(node.parent.type, 'VariableDeclarator');
- t.equal(node.parent.source(), 'xs = [ 1, 2, 3 ]');
+ t.equal(
+ ffBracket(node.parent.source()),
+ 'xs = [ 1, 2, 3 ]'
+ );
t.equal(node.parent.parent.type, 'VariableDeclaration');
- t.equal(node.parent.parent.source(), 'var xs = [ 1, 2, 3 ];');
+ t.equal(
+ ffBracket(node.parent.parent.source()),
+ 'var xs = [ 1, 2, 3 ];'
+ );
node.parent.update('ys = 4;');
}
});
Function(['fn'], output)(function (x) { t.equal(x, 4) });
});
+
+function ffBracket (s) {
+ return s.replace(/\[\s*/, '[ ').replace(/\s*\]/, ' ]');
+}
Please sign in to comment.
Something went wrong with that request. Please try again.