Create $PROFILE if it does not exist for -WorkingDirectory
processing test (#8152)
This commit is contained in:
parent
d9803b24d8
commit
1eec123f48
|
@ -583,7 +583,13 @@ foo
|
|||
|
||||
It "-WorkingDirectory should be processed before profiles" {
|
||||
|
||||
$currentProfile = Get-Content $PROFILE
|
||||
if (Test-Path $PROFILE) {
|
||||
$currentProfile = Get-Content $PROFILE
|
||||
}
|
||||
else {
|
||||
New-Item -ItemType File -Path $PROFILE -Force
|
||||
}
|
||||
|
||||
@"
|
||||
(Get-Location).Path
|
||||
Set-Location $testdrive
|
||||
|
@ -596,7 +602,12 @@ foo
|
|||
$out[1] | Should -BeExactly "$testdrive"
|
||||
}
|
||||
finally {
|
||||
Set-Content $PROFILE -Value $currentProfile
|
||||
if ($currentProfile) {
|
||||
Set-Content $PROFILE -Value $currentProfile
|
||||
}
|
||||
else {
|
||||
Remove-Item $PROFILE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue