diff options
Diffstat (limited to 'node_modules/shell-quote/test/env_fn.js')
| -rw-r--r-- | node_modules/shell-quote/test/env_fn.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/node_modules/shell-quote/test/env_fn.js b/node_modules/shell-quote/test/env_fn.js new file mode 100644 index 0000000..968e912 --- /dev/null +++ b/node_modules/shell-quote/test/env_fn.js @@ -0,0 +1,21 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../').parse; + +function getEnv() { + return 'xxx'; +} + +function getEnvObj() { + return { op: '@@' }; +} + +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']); +}); |
