Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52150fd

Browse files
authored
Add more tests forPSForEach andPSWhere methods (#25519)
1 parent32fd8b1 commit52150fd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎test/powershell/engine/ETS/Adapter.Tests.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ Describe "Adapter Tests" -tags "CI" {
204204
It"Can use PSForEach as an alias for the Foreach magic method" {
205205
$x=5
206206
$x.PSForEach({$_})| Should-Be5
207+
208+
$p=$null.PSForEach{"I didn't run"}
209+
$p.GetType().Name| Should-BeExactly'Collection`1'
210+
$p.Count| Should-BeExactly0
211+
212+
([pscustomobject]@{Name='bar' }).PSForEach({$_.Name})| Should-BeExactly'bar'
207213
}
208214
}
209215

@@ -249,6 +255,12 @@ Describe "Adapter Tests" -tags "CI" {
249255
It"Can use PSWhere as an alias for the Where magic method" {
250256
$x=5
251257
$x.PSWhere{$true}| Should-Be5
258+
259+
$p=$null.PSWhere{"I didn't run"}
260+
$p.GetType().Name| Should-BeExactly'Collection`1'
261+
$p.Count| Should-BeExactly0
262+
263+
([pscustomobject]@{Name='bar' }).PSWhere({$_.Name})|ForEach-Object Name| Should-BeExactly'bar'
252264
}
253265
}
254266
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp