Files
PowerShell/test/powershell/Environment-Variables.Tests.ps1
T

43 lines
915 B
PowerShell
Raw Normal View History

2016-03-04 14:48:30 -08:00
Describe "Environment-Variables" {
2015-12-28 11:05:48 -08:00
2015-08-24 11:38:32 -07:00
It "Should have environment variables" {
Get-Item ENV: | Should Not BeNullOrEmpty
2015-07-15 10:15:39 -07:00
}
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
}
2015-08-24 11:38:32 -07:00
}
It "Should be able to set the environment variables" {
$expected = "this is a test environment variable"
{ $ENV:TESTENVIRONMENTVARIABLE = $expected } | Should Not Throw
2015-08-24 11:38:32 -07:00
$ENV:TESTENVIRONMENTVARIABLE | Should Not BeNullOrEmpty
$ENV:TESTENVIRONMENTVARIABLE | Should Be $expected
2015-07-15 10:15:39 -07:00
}
}