-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy path.test.ps1
36 lines (31 loc) · 1.08 KB
/
.test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Error in all versions.
task test1.expected.error {
($r = try {.\test1.expected.error.ps1} catch {$_})
equals $r.FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand'
}
# v2: error, as expected.
# v3: no error, no results.
task test2.unexpected.nothing {
($r = try {.\test2.unexpected.nothing.ps1} catch {$_})
if ($PSVersionTable.PSVersion.Major -eq 2) {
equals $r.FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand'
}
else {
equals $null $r
}
}
# v2: error, as expected.
# v3: some unexpected items.
task test3.unexpected.something {
($r = try {.\test3.unexpected.something.ps1} catch {$_})
if ($PSVersionTable.PSVersion.Major -eq 2) {
equals $r.FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand'
}
else {
equals $r.Count 2
assert ($r[0].PSIsContainer)
assert ($r[0].FullName -like '*\z\6d460559-a89d-405c-9782-42bf39b70894')
assert (!$r[1].PSIsContainer)
assert ($r[1].FullName -like '*\z\6d460559-a89d-405c-9782-42bf39b70894\6d460559-a89d-405c-9782-42bf39b70894')
}
}