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

20 lines
541 B
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
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: '@@' };
}
});