mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Add new test files to Language directory
This commit is contained in:
1 parent
395657e33c
commit
cb08681a55
28 files changed
+4765
No files matched your search
@@ -0,0 +1,46 @@
|
||||
Describe 'Misc Test' -Tags "innerloop", "DRT" {
|
||||
|
||||
Context 'Where' {
|
||||
class C1 {
|
||||
[int[]] $Wheels = @(1,2,3);
|
||||
[string] Foo() {
|
||||
return (1..10).Where({ $PSItem -in $this.Wheels; }) -join ';'
|
||||
}
|
||||
|
||||
[string] Bar()
|
||||
{
|
||||
return (1..10 | Where { $PSItem -in $this.Wheels; }) -join ';'
|
||||
}
|
||||
}
|
||||
It 'Invoke Where' {
|
||||
[C1]::new().Foo() | should be "1;2;3"
|
||||
}
|
||||
It 'Pipe to where' {
|
||||
[C1]::new().Bar() | should be "1;2;3"
|
||||
}
|
||||
}
|
||||
|
||||
Context 'ForEach' {
|
||||
class C1 {
|
||||
[int[]] $Wheels = @(1,2,3);
|
||||
[string] Foo() {
|
||||
$ret=""
|
||||
Foreach($PSItem in $this.Wheels) { $ret +="$PSItem;"}
|
||||
return $ret
|
||||
}
|
||||
|
||||
[string] Bar()
|
||||
{
|
||||
$ret = ""
|
||||
$this.Wheels | foreach { $ret += "$_;" }
|
||||
return $ret
|
||||
}
|
||||
}
|
||||
It 'Invoke Foreach' {
|
||||
[C1]::new().Foo() | should be "1;2;3;"
|
||||
}
|
||||
It 'Pipe to Foreach' {
|
||||
[C1]::new().Bar() | should be "1;2;3;"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user