This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 646
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go.gopath and go.toolsGopath now expand ${env:XXX} (#1743)
* go.gopath and go.toolsGopath now expand ${env:XXX} * Fix linting errors * remove 'm' flag from substituteEnv * add test for substituteEnv * add newline on end of utils.test.ts
- Loading branch information
1 parent
009501d
commit ea15676
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------*/ | ||
|
||
import * as assert from 'assert'; | ||
import { substituteEnv } from '../../src/util'; | ||
|
||
suite('utils Tests', () => { | ||
test('substituteEnv: default', () => { | ||
|
||
// prepare test | ||
const env = Object.assign({}, process.env); | ||
process.env['test1'] = 'abcd'; | ||
process.env['test2'] = 'defg'; | ||
|
||
let actual = substituteEnv(' ${env:test1} \r\n ${env:test2}\r\n${env:test1}'); | ||
let expected = ' abcd \r\n defg\r\nabcd'; | ||
|
||
assert.equal(actual, expected); | ||
|
||
// test completed | ||
process.env = env; | ||
}); | ||
}); |