Fix Windows consistency tests

Use `USERPROFILE`, not `HOME`. The latter doesn't exist on Windows, and
`HOMEPATH` strips the drive. The former provides `C:\Users\<username>`.

Fix location tested for JIT cache location on Windows.
This commit is contained in:
Andy Schwartzmeyer 2016-06-06 15:23:03 -07:00 committed by Andrew Schwartzmeyer
parent 539f8696e5
commit a48c5281a5

View file

@ -21,7 +21,7 @@ Describe "XDG Base Directory Specification" {
Context "Profile" {
It "Should not change Windows behavior" -Skip:($IsLinux -or $IsOSX) {
$expected = [IO.Path]::Combine($env:HOME, "Documents", "WindowsPowerShell", $profileName)
$expected = [IO.Path]::Combine($env:USERPROFILE, "Documents", "WindowsPowerShell", $profileName)
& $powershell -noprofile `$PROFILE | Should Be $expected
}
@ -40,7 +40,7 @@ Describe "XDG Base Directory Specification" {
Context "Modules" {
It "Should not change Windows behavior" -Skip:($IsLinux -or $IsOSX) {
$expected = [IO.Path]::Combine($env:HOME, "Documents", "WindowsPowerShell", "Modules")
$expected = [IO.Path]::Combine($env:USERPROFILE, "Documents", "WindowsPowerShell", "Modules")
$actual = & $powershell -noprofile `$env:PSMODULEPATH
# Windows prepends the system path, so the user path is second
$actual.split(';')[1] | Should Be $expected
@ -85,7 +85,7 @@ Describe "XDG Base Directory Specification" {
Context "Cache" {
It "Should not change Windows behavior" -Skip:($IsLinux -or $IsOSX) {
$expected = [IO.Path]::Combine($env:HOME, "Documents", "WindowsPowerShell", "StartupProfileData-NonInteractive")
$expected = [IO.Path]::Combine($env:LOCALAPPDATA, "Microsoft", "Windows", "PowerShell", "StartupProfileData-NonInteractive")
Remove-Item -ErrorAction SilentlyContinue $expected
& $powershell -noprofile { exit }
$expected | Should Exist