more.js 616 B

12345678910111213141516171819
  1. var shellescape = require('../');
  2. var assert = require('assert');
  3. var d = {
  4. "echo 'hello\\nworld'": ['echo', 'hello\\nworld'],
  5. "echo 'hello\\tworld'": ['echo', 'hello\\tworld'],
  6. "echo '\thello\nworld'\\'": ['echo', '\thello\nworld\''],
  7. "echo 'hello world'": ['echo', 'hello world'],
  8. "echo hello world": ['echo', 'hello', 'world'],
  9. "echo 'hello\\\\'\\' \\''\\\\'\\''world'": ["echo", "hello\\\\'", "'\\\\'world"],
  10. "echo hello 'world\\'": ["echo", "hello", "world\\"]
  11. };
  12. Object.keys(d).forEach(function(s) {
  13. var escaped = shellescape(d[s]);
  14. assert.strictEqual(escaped, s);
  15. console.log(s);
  16. });