summaryrefslogtreecommitdiffstats
path: root/node_modules/shell-quote/test
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/shell-quote/test')
-rw-r--r--node_modules/shell-quote/test/comment.js14
-rw-r--r--node_modules/shell-quote/test/env.js41
-rw-r--r--node_modules/shell-quote/test/env_fn.js19
-rw-r--r--node_modules/shell-quote/test/op.js78
-rw-r--r--node_modules/shell-quote/test/parse.js23
-rw-r--r--node_modules/shell-quote/test/quote.js42
-rw-r--r--node_modules/shell-quote/test/set.js29
7 files changed, 0 insertions, 246 deletions
diff --git a/node_modules/shell-quote/test/comment.js b/node_modules/shell-quote/test/comment.js
deleted file mode 100644
index bc6fbf2..0000000
--- a/node_modules/shell-quote/test/comment.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var test = require('tape');
-var parse = require('../').parse;
-
-test('comment', function (t) {
- t.same(parse('beep#boop'), [ 'beep', { comment: 'boop' } ]);
- t.same(parse('beep #boop'), [ 'beep', { comment: 'boop' } ]);
- t.same(parse('beep # boop'), [ 'beep', { comment: 'boop' } ]);
- t.same(parse('beep # > boop'), [ 'beep', { comment: '> boop' } ]);
- t.same(parse('beep # "> boop"'), [ 'beep', { comment: '"> boop"' } ]);
- t.same(parse('beep "#"'), [ 'beep', '#' ]);
- t.same(parse('beep #"#"#'), [ 'beep', { comment: '"#"#' } ]);
- t.same(parse('beep > boop # > foo'), [ 'beep', {op: '>'}, 'boop', { comment: '> foo' } ]);
- t.end();
-});
diff --git a/node_modules/shell-quote/test/env.js b/node_modules/shell-quote/test/env.js
deleted file mode 100644
index b3faeb0..0000000
--- a/node_modules/shell-quote/test/env.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var test = require('tape');
-var parse = require('../').parse;
-
-test('expand environment variables', function (t) {
- t.same(parse('a $XYZ c', { XYZ: 'b' }), [ 'a', 'b', 'c' ]);
- t.same(parse('a${XYZ}c', { XYZ: 'b' }), [ 'abc' ]);
- t.same(parse('a${XYZ}c $XYZ', { XYZ: 'b' }), [ 'abc', 'b' ]);
- t.same(parse('"-$X-$Y-"', { X: 'a', Y: 'b' }), [ '-a-b-' ]);
- t.same(parse("'-$X-$Y-'", { X: 'a', Y: 'b' }), [ '-$X-$Y-' ]);
- t.same(parse('qrs"$zzz"wxy', { zzz: 'tuv' }), [ 'qrstuvwxy' ]);
- t.same(parse("qrs'$zzz'wxy", { zzz: 'tuv' }), [ 'qrs$zzzwxy' ]);
- t.same(parse("qrs${zzz}wxy"), [ 'qrswxy' ]);
- t.same(parse("qrs$wxy $"), [ 'qrs', '$' ]);
- t.same(parse('grep "xy$"'), [ 'grep', 'xy$' ]);
- t.same(parse("ab$x", { x: 'c' }), [ 'abc' ]);
- t.same(parse("ab\\$x", { x: 'c' }), [ 'ab$x' ]);
- t.same(parse("ab${x}def", { x: 'c' }), [ 'abcdef' ]);
- t.same(parse("ab\\${x}def", { x: 'c' }), [ 'ab${x}def' ]);
- t.same(parse('"ab\\${x}def"', { x: 'c' }), [ 'ab${x}def' ]);
-
- t.end();
-});
-
-test('environment variables with metacharacters', function (t) {
- t.same(parse('a $XYZ c', { XYZ: '"b"' }), [ 'a', '"b"', 'c' ]);
- t.same(parse('a $XYZ c', { XYZ: '$X', X: 5 }), [ 'a', '$X', 'c' ]);
- t.same(parse('a"$XYZ"c', { XYZ: "'xyz'" }), [ "a'xyz'c" ]);
-
- t.end();
-});
-
-test('special shell parameters', function (t) {
- var chars = '*@#?-$!0_'.split('');
- t.plan(chars.length);
-
- chars.forEach(function (c) {
- var env = {};
- env[c] = 'xxx';
- t.same(parse('a $' + c + ' c', env), [ 'a', 'xxx', 'c' ]);
- });
-});
diff --git a/node_modules/shell-quote/test/env_fn.js b/node_modules/shell-quote/test/env_fn.js
deleted file mode 100644
index b9f3c20..0000000
--- a/node_modules/shell-quote/test/env_fn.js
+++ /dev/null
@@ -1,19 +0,0 @@
-var test = require('tape');
-var parse = require('../').parse;
-
-test('functional env expansion', function (t) {
- t.plan(4);
-
- t.same(parse('a $XYZ c', getEnv), [ 'a', 'xxx', 'c' ]);
- t.same(parse('a $XYZ c', getEnvObj), [ 'a', { op: '@@' }, 'c' ]);
- t.same(parse('a${XYZ}c', getEnvObj), [ 'a', { op: '@@' }, 'c' ]);
- t.same(parse('"a $XYZ c"', getEnvObj), [ 'a ', { op: '@@' }, ' c' ]);
-
- function getEnv (key) {
- return 'xxx';
- }
-
- function getEnvObj (key) {
- return { op: '@@' };
- }
-});
diff --git a/node_modules/shell-quote/test/op.js b/node_modules/shell-quote/test/op.js
deleted file mode 100644
index 7aa9b49..0000000
--- a/node_modules/shell-quote/test/op.js
+++ /dev/null
@@ -1,78 +0,0 @@
-var test = require('tape');
-var parse = require('../').parse;
-
-test('single operators', function (t) {
- t.same(parse('beep | boop'), [ 'beep', { op: '|' }, 'boop' ]);
- t.same(parse('beep|boop'), [ 'beep', { op: '|' }, 'boop' ]);
- t.same(parse('beep \\| boop'), [ 'beep', '|', 'boop' ]);
- t.same(parse('beep "|boop"'), [ 'beep', '|boop' ]);
-
- t.same(parse('echo zing &'), [ 'echo', 'zing', { op: '&' } ]);
- t.same(parse('echo zing&'), [ 'echo', 'zing', { op: '&' } ]);
- t.same(parse('echo zing\\&'), [ 'echo', 'zing&' ]);
- t.same(parse('echo "zing\\&"'), [ 'echo', 'zing\\&' ]);
-
- t.same(parse('beep;boop'), [ 'beep', { op: ';' }, 'boop' ]);
- t.same(parse('(beep;boop)'), [
- { op: '(' }, 'beep', { op: ';' }, 'boop', { op: ')' }
- ]);
-
- t.same(parse('beep>boop'), [ 'beep', { op: '>' }, 'boop' ]);
- t.same(parse('beep 2>boop'), [ 'beep', '2', { op: '>' }, 'boop' ]);
- t.same(parse('beep<boop'), [ 'beep', { op: '<' }, 'boop' ]);
-
- t.end();
-});
-
-test('double operators', function (t) {
- t.same(parse('beep || boop'), [ 'beep', { op: '||' }, 'boop' ]);
- t.same(parse('beep||boop'), [ 'beep', { op: '||' }, 'boop' ]);
- t.same(parse('beep ||boop'), [ 'beep', { op: '||' }, 'boop' ]);
- t.same(parse('beep|| boop'), [ 'beep', { op: '||' }, 'boop' ]);
- t.same(parse('beep || boop'), [ 'beep', { op: '||' }, 'boop' ]);
-
- t.same(parse('beep && boop'), [ 'beep', { op: '&&' }, 'boop' ]);
- t.same(
- parse('beep && boop || byte'),
- [ 'beep', { op: '&&' }, 'boop', { op: '||' }, 'byte' ]
- );
- t.same(
- parse('beep&&boop||byte'),
- [ 'beep', { op: '&&' }, 'boop', { op: '||' }, 'byte' ]
- );
- t.same(
- parse('beep\\&\\&boop||byte'),
- [ 'beep&&boop', { op: '||' }, 'byte' ]
- );
- t.same(
- parse('beep\\&&boop||byte'),
- [ 'beep&', { op: '&' }, 'boop', { op: '||' }, 'byte' ]
- );
- t.same(
- parse('beep;;boop|&byte>>blip'),
- [ 'beep', { op: ';;' }, 'boop', { op: '|&' }, 'byte', { op: '>>' }, 'blip' ]
- );
-
- t.same(parse('beep 2>&1'), [ 'beep', '2', { op: '>&' }, '1' ]);
-
- t.same(
- parse('beep<(boop)'),
- [ 'beep', { op: '<(' }, 'boop', { op: ')' } ]
- );
- t.same(
- parse('beep<<(boop)'),
- [ 'beep', { op: '<' }, { op: '<(' }, 'boop', { op: ')' } ]
- );
-
- t.end();
-});
-
-test('glob patterns', function (t) {
- t.same(
- parse('tap test/*.test.js'),
- [ 'tap', { op: 'glob', pattern: 'test/*.test.js' } ]
- );
-
- t.same(parse('tap "test/*.test.js"'), ['tap', 'test/*.test.js']);
- t.end();
-})
diff --git a/node_modules/shell-quote/test/parse.js b/node_modules/shell-quote/test/parse.js
deleted file mode 100644
index 2df4419..0000000
--- a/node_modules/shell-quote/test/parse.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var test = require('tape');
-var parse = require('../').parse;
-
-test('parse shell commands', function (t) {
- t.same(parse('a \'b\' "c"'), [ 'a', 'b', 'c' ]);
- t.same(
- parse('beep "boop" \'foo bar baz\' "it\'s \\"so\\" groovy"'),
- [ 'beep', 'boop', 'foo bar baz', 'it\'s "so" groovy' ]
- );
- t.same(parse('a b\\ c d'), [ 'a', 'b c', 'd' ]);
- t.same(parse('\\$beep bo\\`op'), [ '$beep', 'bo`op' ]);
- t.same(parse('echo "foo = \\"foo\\""'), [ 'echo', 'foo = "foo"' ]);
- t.same(parse(''), []);
- t.same(parse(' '), []);
- t.same(parse("\t"), []);
- t.same(parse('a"b c d"e'), [ 'ab c de' ]);
- t.same(parse('a\\ b"c d"\\ e f'), [ 'a bc d e', 'f' ]);
- t.same(parse('a\\ b"c d"\\ e\'f g\' h'), [ 'a bc d ef g', 'h' ]);
- t.same(parse("x \"bl'a\"'h'"), ['x', "bl'ah"])
- t.same(parse("x bl^'a^'h'", {}, { escape: '^'}), ['x', "bl'a'h"]);
-
- t.end();
-});
diff --git a/node_modules/shell-quote/test/quote.js b/node_modules/shell-quote/test/quote.js
deleted file mode 100644
index 7c31f01..0000000
--- a/node_modules/shell-quote/test/quote.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var test = require('tape');
-var quote = require('../').quote;
-
-test('quote', function (t) {
- t.equal(quote([ 'a', 'b', 'c d' ]), 'a b \'c d\'');
- t.equal(
- quote([ 'a', 'b', "it's a \"neat thing\"" ]),
- 'a b "it\'s a \\"neat thing\\""'
- );
- t.equal(
- quote([ '$', '`', '\'' ]),
- '\\$ \\` "\'"'
- );
- t.equal(quote([]), '');
- t.equal(quote(["a\nb"]), "'a\nb'");
- t.equal(quote([' #(){}*|][!']), "' #(){}*|][!'");
- t.equal(quote(["'#(){}*|][!"]), '"\'#(){}*|][\\!"');
- t.equal(quote(["X#(){}*|][!"]), "X\\#\\(\\)\\{\\}\\*\\|\\]\\[\\!");
- t.equal(quote(["a\n#\nb"]), "'a\n#\nb'");
- t.equal(quote(['><;{}']), '\\>\\<\\;\\{\\}');
- t.equal(quote([ 'a', 1, true, false ]), 'a 1 true false');
- t.equal(quote([ 'a', 1, null, undefined ]), 'a 1 null undefined');
- t.equal(quote([ 'a\\x' ]), 'a\\\\x');
- t.end();
-});
-
-test('quote ops', function (t) {
- t.equal(quote([ 'a', { op: '|' }, 'b' ]), 'a \\| b');
- t.equal(
- quote([ 'a', { op: '&&' }, 'b', { op: ';' }, 'c' ]),
- 'a \\&\\& b \\; c'
- );
- t.end();
-});
-
-test('quote windows paths', { skip: 'breaking change, disabled until 2.x' }, function (t) {
- var path = 'C:\\projects\\node-shell-quote\\index.js'
-
- t.equal(quote([path, 'b', 'c d']), 'C:\\projects\\node-shell-quote\\index.js b \'c d\'')
-
- t.end()
-})
diff --git a/node_modules/shell-quote/test/set.js b/node_modules/shell-quote/test/set.js
deleted file mode 100644
index ac45cf1..0000000
--- a/node_modules/shell-quote/test/set.js
+++ /dev/null
@@ -1,29 +0,0 @@
-var test = require('tape');
-var parse = require('../').parse;
-
-test('set env vars', function (t) {
- t.same(
- parse('ABC=444 x y z'),
- [ 'ABC=444', 'x', 'y', 'z' ]
- );
- t.same(
- parse('ABC=3\\ 4\\ 5 x y z'),
- [ 'ABC=3 4 5', 'x', 'y', 'z' ]
- );
- t.same(
- parse('X="7 8 9" printx'),
- [ 'X=7 8 9', 'printx' ]
- );
- t.same(
- parse('X="7 8 9"; printx'),
- [ 'X=7 8 9', { op: ';' }, 'printx' ]
- );
- t.same(
- parse('X="7 8 9"; printx', function (key) {
- t.fail('should not have matched any keys');
- }),
- [ 'X=7 8 9', { op: ';' }, 'printx' ]
- );
-
- t.end();
-});