1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/shell-quote/test/env_fn.js

22 lines
483 B
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
'use strict';
2023-12-18 13:12:25 +08:00
var test = require('tape');
var parse = require('../').parse;
2024-01-16 21:26:16 +08:00
function getEnv() {
return 'xxx';
}
function getEnvObj() {
return { op: '@@' };
}
2023-12-18 13:12:25 +08:00
test('functional env expansion', function (t) {
2024-01-16 21:26:16 +08:00
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']);
2023-12-18 13:12:25 +08:00
});