forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironment-Variables.Tests.ps1
More file actions
43 lines (36 loc) · 926 Bytes
/
Copy pathEnvironment-Variables.Tests.ps1
File metadata and controls
43 lines (36 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Describe "Environment-Variables" -Tags "CI" {
It "Should have environment variables" {
Get-Item ENV: | Should Not BeNullOrEmpty
}
It "Should have a nonempty PATH" {
$ENV:PATH | Should Not BeNullOrEmpty
}
It "Should contain /bin in the PATH" {
if ($IsWindows)
{
$ENV:PATH | Should Match "C:"
}
else
{
$ENV:PATH | Should Match "/bin"
}
}
It "Should have the correct HOME" {
if ($IsWindows)
{
$expected = "\Users"
Split-Path $ENV:HOMEPATH -Parent | Should Be $expected
}
else
{
$expected = /bin/bash -c "cd ~ && pwd"
$ENV:HOME | Should Be $expected
}
}
It "Should be able to set the environment variables" {
$expected = "this is a test environment variable"
{ $ENV:TESTENVIRONMENTVARIABLE = $expected } | Should Not Throw
$ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty
$ENV:TESTENVIRONMENTVARIABLE | Should Be $expected
}
}