Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/Format2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ function Get-DisplayProperty2 ([Type]$Type) {
# and for types that do not exist

$propertyMap = @{
'System.Diagnostics.Process' = 'Id', 'Name'
'System.Diagnostics.Process' = 'Id', 'Name'
# DirectoryInfo and FileInfo have circular references (Root, Directory) that cause infinite recursion
'System.IO.DirectoryInfo' = 'Name', 'FullName'
'System.IO.FileInfo' = 'Name', 'FullName', 'Length'
}

$propertyMap[$Type.FullName]
Expand Down
2 changes: 1 addition & 1 deletion src/functions/assertions/Exist.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
`Should -Exist` calls Test-Path. Test-Path expects a file,
returns $false because the file was removed, and fails the test.
#>
[bool] $succeeded = & $SafeCommands['Test-Path'] $ActualValue
[bool] $succeeded = & $SafeCommands['Test-Path'] -LiteralPath $ActualValue

if ($Negate) {
$succeeded = -not $succeeded
Expand Down
4 changes: 2 additions & 2 deletions tst/functions/assertions/Exist.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ InPesterModuleScope {
"TestDrive:\nonexistant" | Should -Not -Exist
}

It 'works for path with escaped [ ] characters' {
It 'works for path with literal [ ] characters' {
New-Item -Path "TestDrive:\[test].txt" -ItemType File | Out-Null
"TestDrive:\``[test``].txt" | Should -Exist
Comment on lines -14 to -16
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

revert this and follow the design, the default behavior of Should -Exist has to remain the same ( a thin wrapper over Test-Path) and additional -LiteralPath parameter for specifying escaped path, following the semantics of Test-Path

"TestDrive:\[test].txt" | Should -Exist
}

It 'returns correct result for function drive' {
Expand Down
Loading