diff options
author | Mathias Bynens <mathias@qiwi.be> | 2013-08-07 12:41:14 +0200 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2013-08-07 12:41:14 +0200 |
commit | be19d96993061fd7f34e5dea42d8ec07b090682b (patch) | |
tree | 10331c3a2b2d4c3dabd3b23f6c1d33bb090d0848 | |
parent | 993b1011ea196cb4529ec9842b91ce5de900cadd (diff) | |
download | he-be19d96993061fd7f34e5dea42d8ec07b090682b.zip he-be19d96993061fd7f34e5dea42d8ec07b090682b.tar.gz he-be19d96993061fd7f34e5dea42d8ec07b090682b.tar.bz2 |
Remove unit tests for the binary
This allows me to remove support for using the binary from within a non-TTY context.
-rw-r--r-- | tests/tests.js | 208 | ||||
-rw-r--r-- | tests/tests.src.js | 208 |
2 files changed, 0 insertions, 416 deletions
diff --git a/tests/tests.js b/tests/tests.js index 3d6f7da..cfcdbb1 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -8674,214 +8674,6 @@ ); }); - // Test binary in Node only - var isNode = typeof process != 'undefined' && process.argv && - process.argv[0] == 'node'; - - isNode && asyncTest('he binary', function() { - - var exec = require('child_process').exec; - - var shellTest = function(command, callback) { - exec(command, function(error, stdout, stderr) { - callback({ - 'stdout': stdout, - 'stderr': stderr, - 'exitStatus': error ? error.code : 0 - }); - }); - }; - - var tests = [ - { - 'description': 'No arguments', - 'command': './bin/he', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '-h option', - 'command': './bin/he -h', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--help option', - 'command': './bin/he --help', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '-v option', - 'command': './bin/he -v', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--version option', - 'command': './bin/he --version', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': 'No options', - 'command': './bin/he "foo"', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': 'No options, piping content', - 'command': 'echo "foo" | ./bin/he', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--escape option', - 'command': './bin/he --escape \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\>', - 'expected': { - 'stdout': '<img src='x' onerror="prompt(1)">\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--escape option, piping content', - 'command': 'echo \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\> | ./bin/he --escape', - 'expected': { - 'stdout': '<img src='x' onerror="prompt(1)">\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode option', - 'command': './bin/he --encode \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\'', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode option, piping content', - 'command': 'echo \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\' | ./bin/he --encode', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode --use-named-refs options', - 'command': './bin/he --encode --use-named-refs \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\'', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode --use-named-refs options, piping content', - 'command': 'echo \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\' | ./bin/he --encode --use-named-refs', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode option', - 'command': './bin/he --decode \'foo © bar ≠ baz 𝌆 qux\'', - 'expected': { - 'stdout': 'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode option, piping content', - 'command': 'echo \'foo © bar ≠ baz 𝌆 qux foo&bar\' | ./bin/he --decode', - 'expected': { - 'stdout': 'foo \xA9 bar \u2260 baz \uD834\uDF06 qux foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --attribute options', - 'command': './bin/he --decode --attribute \'foo&bar\'', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --attribute options, piping content', - 'command': 'echo \'foo&bar\' | ./bin/he --decode --attribute', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --strict options, throwing', - 'command': './bin/he --decode --strict \'foo&bar\'', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--decode --strict options, throwing, piping content', - 'command': 'echo \'foo&bar\' | ./bin/he --decode --strict', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--decode --strict options, not throwing', - 'command': './bin/he --decode --strict \'foo&bar\'', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --strict options, not throwing, piping content', - 'command': 'echo \'foo&bar\' | ./bin/he --decode --strict', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - } - ]; - var counter = tests.length; - function done() { - --counter || QUnit.start(); - } - - tests.forEach(function(object) { - shellTest(object.command, function(data) { - // We can’t use `deepEqual` since sometimes not all expected values are provided - Object.keys(object.expected).forEach(function(key) { - equal(data[key], object.expected[key], object.description); - }); - done(); - }); - }); - - }); - /*--------------------------------------------------------------------------*/ // configure QUnit and call `QUnit.start()` for diff --git a/tests/tests.src.js b/tests/tests.src.js index cf5c42a..77c4d91 100644 --- a/tests/tests.src.js +++ b/tests/tests.src.js @@ -6442,214 +6442,6 @@ ); }); - // Test binary in Node only - var isNode = typeof process != 'undefined' && process.argv && - process.argv[0] == 'node'; - - isNode && asyncTest('he binary', function() { - - var exec = require('child_process').exec; - - var shellTest = function(command, callback) { - exec(command, function(error, stdout, stderr) { - callback({ - 'stdout': stdout, - 'stderr': stderr, - 'exitStatus': error ? error.code : 0 - }); - }); - }; - - var tests = [ - { - 'description': 'No arguments', - 'command': './bin/he', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '-h option', - 'command': './bin/he -h', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--help option', - 'command': './bin/he --help', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '-v option', - 'command': './bin/he -v', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--version option', - 'command': './bin/he --version', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': 'No options', - 'command': './bin/he "foo"', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': 'No options, piping content', - 'command': 'echo "foo" | ./bin/he', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--escape option', - 'command': './bin/he --escape \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\>', - 'expected': { - 'stdout': '<img src='x' onerror="prompt(1)">\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--escape option, piping content', - 'command': 'echo \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\> | ./bin/he --escape', - 'expected': { - 'stdout': '<img src='x' onerror="prompt(1)">\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode option', - 'command': './bin/he --encode \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\'', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode option, piping content', - 'command': 'echo \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\' | ./bin/he --encode', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode --use-named-refs options', - 'command': './bin/he --encode --use-named-refs \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\'', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--encode --use-named-refs options, piping content', - 'command': 'echo \'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\' | ./bin/he --encode --use-named-refs', - 'expected': { - 'stdout': 'foo © bar ≠ baz 𝌆 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode option', - 'command': './bin/he --decode \'foo © bar ≠ baz 𝌆 qux\'', - 'expected': { - 'stdout': 'foo \xA9 bar \u2260 baz \uD834\uDF06 qux\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode option, piping content', - 'command': 'echo \'foo © bar ≠ baz 𝌆 qux foo&bar\' | ./bin/he --decode', - 'expected': { - 'stdout': 'foo \xA9 bar \u2260 baz \uD834\uDF06 qux foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --attribute options', - 'command': './bin/he --decode --attribute \'foo&bar\'', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --attribute options, piping content', - 'command': 'echo \'foo&bar\' | ./bin/he --decode --attribute', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --strict options, throwing', - 'command': './bin/he --decode --strict \'foo&bar\'', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--decode --strict options, throwing, piping content', - 'command': 'echo \'foo&bar\' | ./bin/he --decode --strict', - 'expected': { - 'exitStatus': 1 - } - }, - { - 'description': '--decode --strict options, not throwing', - 'command': './bin/he --decode --strict \'foo&bar\'', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - }, - { - 'description': '--decode --strict options, not throwing, piping content', - 'command': 'echo \'foo&bar\' | ./bin/he --decode --strict', - 'expected': { - 'stdout': 'foo&bar\n', - 'stderr': '', - 'exitStatus': 0 - } - } - ]; - var counter = tests.length; - function done() { - --counter || QUnit.start(); - } - - tests.forEach(function(object) { - shellTest(object.command, function(data) { - // We can’t use `deepEqual` since sometimes not all expected values are provided - Object.keys(object.expected).forEach(function(key) { - equal(data[key], object.expected[key], object.description); - }); - done(); - }); - }); - - }); - /*--------------------------------------------------------------------------*/ // configure QUnit and call `QUnit.start()` for |