-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy path.test.ps1
31 lines (25 loc) · 1022 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
26
27
28
29
30
31
task Test-1-simple-but-poor-error-message {
($r = try {.\Test-1-simple-but-poor-error-message.ps1} catch {$_})
assert ($r -like '*"$_ -match ''^\w+$''"*')
}
task Test-2.1-good-message-but-incorrect {
($r = try {.\Test-2.1-good-message-but-incorrect.ps1} catch {$_})
assert ($r -like '*Name should contain alphanumeric letters and "_".*')
}
task Test-2.2-good-message-but-incorrect {
($r = try {.\Test-2.2-good-message-but-incorrect.ps1} catch {$_})
assert ($r -like '*if ($_ -notmatch ''^\w+$'')*')
}
task Test-3-correct-and-good-but-not-simple {
($r = try {.\Test-3-correct-and-good-but-not-simple.ps1} catch {$_})
equals $r[0] 'Name is valid_name'
assert ($r -like '*Name should contain alphanumeric letters and "_".*')
}
task Test-4-invoked-for-each-item {
($r = .\Test-4-invoked-for-each-item.ps1)
equals 'Validated 1|Validated 2|Validated 3' ($r -join '|')
}
task Test-5-value-cannot-be-null {
($r = try {.\Test-5-value-cannot-be-null.ps1} catch {$_})
assert ($r -like '*The argument is null,*')
}