diff --git a/test/env_fn.js b/test/env_fn.js new file mode 100644 index 0000000..0762f2d --- /dev/null +++ b/test/env_fn.js @@ -0,0 +1,17 @@ +var test = require('tape'); +var parse = require('../').parse; + +test('functional env expansion', function (t) { + t.plan(2); + + t.same(parse('a $XYZ c', getEnv), [ 'a', 'xxx', 'c' ]); + t.same(parse('a $XYZ c', getEnvObj), [ 'a', { op: '@@' }, 'c' ]); + + function getEnv (key) { + return 'xxx'; + } + + function getEnvObj (key) { + return { op: '@@' }; + } +});