Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions test/powershell/Host/ConsoleHost.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
New-Item -ItemType File -Path $PROFILE -Force
$null = New-Item -ItemType File -Path $PROFILE -Force

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging as this comment is non-blocking.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
New-Item -ItemType File -Path $PROFILE -Force
New-Item -ItemType File -Path $PROFILE -Force > $null

😉

}

@"
(Get-Location).Path
Set-Location $testdrive
Expand All @@ -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
}
}
}
}
Expand Down