Skip to content

Allow variable substitution default value containing a colon #882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add test for variable substitution with default value containing a colon
  • Loading branch information
grthr authored Aug 29, 2024
commit dc40609e1ef012899f6bb6419d872781b42f12bd
15 changes: 15 additions & 0 deletions src/test/variableSubstitution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ describe('Variable substitution', function () {
assert.strictEqual(result.foo, 'bardefaultbar');
});

it(`environment variables with default value containing colon if they do not exist`, async () => {
const raw = {
foo: 'bar${localEnv:baz:de:fault}bar'
};
const result = substitute({
platform: 'linux',
localWorkspaceFolder: '/foo/bar',
containerWorkspaceFolder: '/baz/blue',
configFile: URI.file('/foo/bar/baz.json'),
env: {
},
}, raw);
assert.strictEqual(result.foo, 'barde:faultbar');
});

it(`environment variables without default value if they do not exist`, async () => {
const raw = {
foo: 'bar${localEnv:baz}bar'
Expand Down