mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
20 lines
541 B
JavaScript
20 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: '@@' };
|
||
|
}
|
||
|
});
|