Browse Source

test: expect the folder error of Get-NTFSHardLink as non-terminating

Since a324484, Get-NTFSHardLink writes a non-terminating GetHardLinkError
for a folder. The current-location test still used -ErrorAction
SilentlyContinue and so no longer saw the error; -ErrorAction Stop turns it
into the exception that the test expects. The first full-suite run as a
basic user found it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
ai/release-5.0.0-rc6
Raimund Andree 4 days ago
parent
commit
61b5ab2f56
  1. 3
      Tests/Owner.Tests.ps1

3
Tests/Owner.Tests.ps1

@ -99,8 +99,9 @@ Describe 'Current location' {
Should -Not -Throw
}
# The error for the folder is non-terminating since 5.0.0-rc6, so -ErrorAction Stop turns it into the exception.
It 'Get-NTFSHardLink should report the folder of the current location, not a NullReferenceException' {
{ Invoke-WithShadowedPwd -Command { Get-NTFSHardLink -ErrorAction SilentlyContinue } } |
{ Invoke-WithShadowedPwd -Command { Get-NTFSHardLink -ErrorAction Stop } } |
Should -Throw -ExpectedMessage '*must be a file*'
}
}

Loading…
Cancel
Save