mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
added environment variable tests
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
Describe "Test-Environment-Variables" {
|
||||
It "Should have environment variable" {
|
||||
It "Should have environment variables" {
|
||||
Get-Item ENV: | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Should be able to access the members of the environment variable in two ways" {
|
||||
(Get-Item ENV:HOME).Value | Should be "/root"
|
||||
It "Should be able to access the members of the environment variable" {
|
||||
$test = /usr/bin/whoami
|
||||
$expected = "/" + $test
|
||||
(Get-Item ENV:HOME).Value | Should Be $expected
|
||||
(Get-Item ENV:HOSTNAME).Value | Should Not BeNullOrEmpty
|
||||
(Get-Item ENV:PATH).Value | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Should be able to set the environment variables" {
|
||||
{ $ENV:TESTENVIRONMENTVARIABLE = "this is a test environment variable" } | Should Not Throw
|
||||
|
||||
$ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty
|
||||
$ENV:TESTENVIRONMENTVARIABLE | Should Be "this is a test environment variable"
|
||||
|
||||
(ls ENV:HOME).Value | Should be "/root"
|
||||
(ls ENV:HOSTNAME).Value | Should Not BeNullOrEmpty
|
||||
(ls ENV:PATH).Value | Should Not BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user