diff options
Diffstat (limited to 'deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test')
9 files changed, 0 insertions, 372 deletions
diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/array.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/array.js deleted file mode 100644 index b5f7491199..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/array.js +++ /dev/null @@ -1,35 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -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 ] ]); - } - ); -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/async.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/async.js deleted file mode 100644 index 2887894898..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/async.js +++ /dev/null @@ -1,42 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -test('array', function (t) { - t.plan(5); - - var src = '(function () {' - + 'var xs = [ 1, 2, [ 3, 4 ] ];' - + 'var ys = [ 5, 6 ];' - + 'g([ xs, ys ]);' - + '})()'; - - var pending = 0; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - pending ++; - setTimeout(function () { - node.update('fn(' + node.source() + ')'); - if (--pending === 0) check(); - }, 50 * pending * 2); - } - }); - - var arrays = [ - [ 3, 4 ], - [ 1, 2, [ 3, 4 ] ], - [ 5, 6 ], - [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ], - ]; - - function check () { - Function([ 'fn', 'g' ], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); - } - ); - } -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/bin/run.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/bin/run.js deleted file mode 100755 index 0582075564..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/bin/run.js +++ /dev/null @@ -1,5 +0,0 @@ -var path = require('path'); - -for (var i = 2; i < process.argv.length; i++) { - require(path.resolve(process.cwd(), process.argv[i])); -} diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/custom-parser.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/custom-parser.js deleted file mode 100644 index 2ae09eca75..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/custom-parser.js +++ /dev/null @@ -1,42 +0,0 @@ -var falafel = require('../'); -var acorn = require('acorn-jsx'); -var test = require('tape'); - -test('custom parser', function (t) { - - var src = '(function() { var f = {a: "b"}; var a = <div {...f} className="test"></div>; })()'; - - var nodeTypes = [ - 'Identifier', - 'Identifier', - 'Literal', - 'Property', - 'ObjectExpression', - 'VariableDeclarator', - 'VariableDeclaration', - 'Identifier', - 'Identifier', - 'JSXSpreadAttribute', - 'JSXIdentifier', - 'Literal', - 'JSXAttribute', - 'JSXIdentifier', - 'JSXOpeningElement', - 'JSXIdentifier', - 'JSXClosingElement', - 'JSXElement', - 'VariableDeclarator', - 'VariableDeclaration', - 'BlockStatement', - 'FunctionExpression', - 'CallExpression', - 'ExpressionStatement', - 'Program' - ]; - - t.plan(nodeTypes.length); - - var output = falafel(src, {parser: acorn, ecmaVersion: 6, plugins: { jsx: true }}, function(node) { - t.equal(node.type, nodeTypes.shift()); - }); -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/es6.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/es6.js deleted file mode 100644 index d9a06dcbfa..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/es6.js +++ /dev/null @@ -1,15 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -test('generators', function (t) { - t.plan(1); - - var src = 'console.log((function * () { yield 3 })().next().value)'; - var output = falafel(src, { ecmaVersion: 6 }, function (node) { - if (node.type === 'Literal') { - node.update('555'); - } - }); - Function(['console'],output)({log:log}); - function log (n) { t.equal(n, 555) } -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/for.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/for.js deleted file mode 100644 index e5e230e137..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/for.js +++ /dev/null @@ -1,30 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -test('for loop', function (t) { - t.plan(7); - - var src = '(function () {' - + 'var sum = 0;' - + 'for (var i = 0; i < 10; i++)' - + 'sum += i;' - + 'if (true)' - + 'for (var i = 0; i < 10; i++)' - + 'sum += i;' - + 'return sum;' - + '})()'; - - var output = falafel(src, function (node) { - if (node.type === 'ForStatement') { - t.equal(node.update.source(), 'i++'); - t.equal(node.update.type, "UpdateExpression"); - node.update.update('i+=2'); - } - if (node.type === 'UpdateExpression') { - t.equal(node.source(), 'i++'); - } - }); - - var res = Function('return ' + output)(); - t.equal(res, 2 + 4 + 6 + 8 + 2 + 4 + 6 + 8); -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/inspect.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/inspect.js deleted file mode 100644 index c385d74f8a..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/inspect.js +++ /dev/null @@ -1,36 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -test('inspect', 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.equal(output.inspect(), output.toString()); - - 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 ] ]); - } - ); -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/opts.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/opts.js deleted file mode 100644 index b10e0cf095..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/opts.js +++ /dev/null @@ -1,134 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -test('first opts arg', function (t) { - t.plan(5); - - var src = '(function () {' - + 'var xs = [ 1, 2, [ 3, 4 ] ];' - + 'var ys = [ 5, 6 ];' - + 'g([ xs, ys ]);' - + '})()'; - - var output = falafel({ source: 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 ] ]); - } - ); -}); - -test('opts.source', function (t) { - t.plan(5); - - var src = '(function () {' - + 'var xs = [ 1, 2, [ 3, 4 ] ];' - + 'var ys = [ 5, 6 ];' - + 'g([ xs, ys ]);' - + '})()'; - - var output = falafel(undefined, { source: 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 ] ]); - } - ); -}); - -test('Buffer opts.source', function (t) { - t.plan(5); - - var src = Buffer('(function () {' - + 'var xs = [ 1, 2, [ 3, 4 ] ];' - + 'var ys = [ 5, 6 ];' - + 'g([ xs, ys ]);' - + '})()'); - - var output = falafel({ source: 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 ] ]); - } - ); -}); - -test('Buffer source', function (t) { - t.plan(5); - - var src = Buffer('(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 ] ]); - } - ); -}); diff --git a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/parent.js b/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/parent.js deleted file mode 100644 index 8e787360ad..0000000000 --- a/deps/npm/node_modules/readable-stream/node_modules/inline-process-browser/node_modules/falafel/test/parent.js +++ /dev/null @@ -1,33 +0,0 @@ -var falafel = require('../'); -var test = require('tape'); - -test('parent', function (t) { - t.plan(5); - - var src = '(function () {' - + 'var xs = [ 1, 2, 3 ];' - + 'fn(ys);' - + '})()'; - - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - t.equal(node.parent.type, 'VariableDeclarator'); - t.equal( - ffBracket(node.parent.source()), - 'xs = [ 1, 2, 3 ]' - ); - t.equal(node.parent.parent.type, 'VariableDeclaration'); - 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*\]/, ' ]'); -} |