forked from nightroman/PowerShellTraps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.test.ps1
More file actions
35 lines (28 loc) · 740 Bytes
/
.test.ps1
File metadata and controls
35 lines (28 loc) · 740 Bytes
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
$v6 = $PSVersionTable.PSVersion.Major -ge 6
task Test-1-different-ToString {
($r = .\Test-1-different-ToString.ps1)
# full path
assert ($r.strings1[0] -like '*\Different-FileInfo-ToString\.test.ps1')
if ($v6) {
# full path
assert ($r.strings2[0] -like '*\Different-FileInfo-ToString\.test.ps1')
}
else {
# just name
equals $r.strings2[0] '.test.ps1'
}
}
task Test-2-Resolve-Path-fails {
($r = try {.\Test-2-Resolve-Path-fails.ps1} catch {$_})
assert ($r.Count -ge 2)
# first item
equals $r[0].GetType().Name 'PathInfo'
# last item
if ($v6) {
equals $r[-1].GetType().Name 'PathInfo'
}
else {
# error
equals $r[-1].FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.ResolvePathCommand'
}
}