-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy path.test.ps1
39 lines (33 loc) · 1.3 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
37
38
39
$Version = $PSVersionTable.PSVersion.Major
#_200427_195327
task Current.directory.with.odd.name -If ($Version -lt 7) {
($r = .\Current.directory.with.odd.name.ps1)
if ($Version -ge 6) {
# test 1
assert ($r.Location1.EndsWith('\`[1]'))
equals $r.GetChildItem1.Name 'test'
equals $r.GetItemNormal1.FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand'
#! v6.2.0-preview.2
(assert $r.GetItemLiteral1.FullName.EndsWith('\`[1]\test'))
# test 2
assert ($r.Location2.EndsWith('\[1]'))
equals $r.GetChildItem2.Name 'test'
equals $r.GetItemNormal2.Name 'test'
#! v6.2.0-preview.2
(assert $r.GetItemLiteral2.FullName.EndsWith('\[1]\test'))
}
else {
# test 1
assert ($r.Location1.EndsWith('\`[1]'))
equals $r.GetChildItem1.Name 'test'
equals $r.GetItemNormal1.FullyQualifiedErrorId 'PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand'
equals $r.GetItemLiteral1.FullyQualifiedErrorId 'ItemNotFound,Microsoft.PowerShell.Commands.GetItemCommand'
# test 2
assert ($r.Location2.EndsWith('\[1]'))
equals $r.GetChildItem2.Name 'test'
equals $r.GetItemNormal2.Name 'test'
equals $r.GetItemLiteral2.FullyQualifiedErrorId 'ItemNotFound,Microsoft.PowerShell.Commands.GetItemCommand'
}
Set-Location $BuildRoot
Remove-Item -LiteralPath '`[1]', '[1]' -Force -Recurse
}