You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
616 B
20 lines
616 B
2 years ago
|
var shellescape = require('../');
|
||
|
|
||
|
var assert = require('assert');
|
||
|
|
||
|
var d = {
|
||
|
"echo 'hello\\nworld'": ['echo', 'hello\\nworld'],
|
||
|
"echo 'hello\\tworld'": ['echo', 'hello\\tworld'],
|
||
|
"echo '\thello\nworld'\\'": ['echo', '\thello\nworld\''],
|
||
|
"echo 'hello world'": ['echo', 'hello world'],
|
||
|
"echo hello world": ['echo', 'hello', 'world'],
|
||
|
"echo 'hello\\\\'\\' \\''\\\\'\\''world'": ["echo", "hello\\\\'", "'\\\\'world"],
|
||
|
"echo hello 'world\\'": ["echo", "hello", "world\\"]
|
||
|
};
|
||
|
|
||
|
Object.keys(d).forEach(function(s) {
|
||
|
var escaped = shellescape(d[s]);
|
||
|
assert.strictEqual(escaped, s);
|
||
|
console.log(s);
|
||
|
});
|