mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
1 parent
ac3fcd932a
commit
dc1d672a86
2 files changed
+17
-1
No files matched your search
@@ -548,7 +548,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
// properties...
|
||||
foreach (string p in Property)
|
||||
{
|
||||
MshExpression expression = new MshExpression(p, true);
|
||||
MshExpression expression = new MshExpression(p);
|
||||
List<MshExpression> resolvedNames = expression.ResolveNames(inObj);
|
||||
if (resolvedNames == null || resolvedNames.Count == 0)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,22 @@ Describe "Measure-Object" {
|
||||
$actual | Should Be $expected
|
||||
}
|
||||
|
||||
It "Should be able to use wildcards for the Property argument" {
|
||||
$data = [pscustomobject]@{ A1 = 1; A2 = 2; C3 = 3 },
|
||||
[pscustomobject]@{ A1 = 1; A2 = 2; A3 = 3 }
|
||||
$actual = $data | Measure-Object -Property A* -Sum
|
||||
$actual.Count | Should Be 3
|
||||
$actual[0].Property | Should Be A1
|
||||
$actual[0].Sum | Should Be 2
|
||||
$actual[0].Count | Should Be 2
|
||||
$actual[1].Property | Should Be A2
|
||||
$actual[1].Sum | Should Be 4
|
||||
$actual[1].Count | Should Be 2
|
||||
$actual[2].Property | Should Be A3
|
||||
$actual[2].Sum | Should Be 3
|
||||
$actual[2].Count | Should Be 1
|
||||
}
|
||||
|
||||
Context "Numeric tests" {
|
||||
It "Should be able to sum" {
|
||||
$actual = $testObject | Measure-Object -Sum
|
||||
|
||||
Reference in new issue
Block a user