mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Length script property for List View didn't include a name for the property so it defaulted to using the script as the property name (#4437)
This commit is contained in:
1 parent
baa56f9c71
commit
ab764eeac1
2 files changed
+9
-2
No files matched your search
+1
-1
@@ -74,7 +74,7 @@ return $_.Length";
|
||||
.GroupByProperty("PSParentPath", customControl: sharedControls[0])
|
||||
.StartEntry(entrySelectedByType: new[] { "System.IO.FileInfo" })
|
||||
.AddItemProperty(@"Name")
|
||||
.AddItemScriptBlock(LengthScriptBlock)
|
||||
.AddItemScriptBlock(LengthScriptBlock, label: "Length")
|
||||
.AddItemProperty(@"CreationTime")
|
||||
.AddItemProperty(@"LastWriteTime")
|
||||
.AddItemProperty(@"LastAccessTime")
|
||||
|
||||
@@ -149,5 +149,12 @@ Describe "Format-List DRT basic functionality" -Tags "CI" {
|
||||
$result | Should Match "Length : 2"
|
||||
$result | Should Match "Name : name3"
|
||||
$result | Should Match "Length : 3"
|
||||
}
|
||||
}
|
||||
|
||||
It "Format-List with FileInfo should work" {
|
||||
$null = New-Item $testdrive\test.txt -ItemType File -Value "hello" -Force
|
||||
$result = Get-ChildItem -File $testdrive\test.txt | Format-List | Out-String
|
||||
$result | Should Match "Name\s*:\s*test.txt"
|
||||
$result | Should Match "Length\s*:\s*5"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user