summaryrefslogtreecommitdiffstats
path: root/node_modules/shell-quote/test/env_fn.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/shell-quote/test/env_fn.js')
-rw-r--r--node_modules/shell-quote/test/env_fn.js19
1 files changed, 19 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..b9f3c20
--- /dev/null
+++ b/node_modules/shell-quote/test/env_fn.js
@@ -0,0 +1,19 @@
+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: '@@' };
+ }
+});