-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy path.test.ps1
25 lines (21 loc) · 1005 Bytes
/
.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
if ($env:GITHUB_ACTION) {return task GITHUB_ACTION}
if ($PSVersionTable.PSVersion.Major -le 4) {return task skip4}
$ErrorView = 'NormalView' #! v7
task Test-1.missing.item {
($r = try {.\Test-1.missing.item.ps1} catch {$_})
equals $r.Count 2
equals $r[0] 'invoked'
equals $r[1].FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand'
}
task Test-2.existing.item {
($r = exec {Invoke-PowerShell -NoProfile -Command '$ErrorView = ''NormalView''; .\Test-2.existing.item.ps1'} | Out-String)
assert ($r -clike '*FullyQualifiedErrorId*FullyQualifiedErrorId*invoked #1*FullyQualifiedErrorId*invoked #2*')
}
task Test-3.unexpected.stop.try {
($r = .\Test-3.unexpected.stop.try.ps1)
equals $r.FullyQualifiedErrorId 'Argument,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand'
}
task Test-4.unexpected.stop.trap {
($r = .\Test-4.unexpected.stop.trap)
equals $r.FullyQualifiedErrorId 'Argument,Microsoft.PowerShell.Commands.GetItemPropertyValueCommand'
}