-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy path.test.ps1
34 lines (30 loc) · 1.16 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
$Version = $PSVersionTable.PSVersion.Major
$ErrorView = 'NormalView' #! v7
task Test-1.Out-String {
($r = .\Test-1.Out-String.ps1 | Out-String)
if ($Version -eq 2) {
assert ($r -cmatch '(?s)^Error {\s+throw :\s+}.*BufferSize.*FullyQualifiedErrorId : PropertyNotFoundStrict')
}
elseif ($Version -le 5) {
assert ($r -cmatch '(?s)^Error {\s+}.*BufferSize.*FullyQualifiedErrorId : PropertyNotFoundStrict')
}
else {
assert ($r -like 'Error {*Oops!*FullyQualifiedErrorId : Oops!*Oops!*FullyQualifiedErrorId : Oops!*')
}
}
task Test-2.Format-List {
($r = .\Test-2.Format-List.ps1 | Out-String)
if ($Version -eq 2) {
assert ($r -cmatch '(?s)^Error {\s+throw :\s+}.*BufferSize.*FullyQualifiedErrorId : PropertyNotFoundStrict')
}
elseif ($Version -le 5) {
assert ($r -cmatch '(?s)^Error {\s+}.*BufferSize.*FullyQualifiedErrorId : PropertyNotFoundStrict')
}
else {
assert ($r -like 'Error {*Oops!*FullyQualifiedErrorId : Oops!*Oops!*FullyQualifiedErrorId : Oops!*')
}
}
task Test-3.manual.formatting {
($r = .\Test-3.manual.formatting.ps1)
assert ($r -cmatch '(?s)^Oops!.*throw.*\+ CategoryInfo : OperationStopped:.*\+ FullyQualifiedErrorId : Oops!')
}