This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/shell-quote/test/env_fn.js
2019-08-11 20:48:02 +02:00

19 lines
541 B
JavaScript

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: '@@' };
}
});