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
24 lines (20 loc) · 704 Bytes
/
.test.ps1
File metadata and controls
24 lines (20 loc) · 704 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
if ($env:GITHUB_ACTION) {return task GITHUB_ACTION}
$NET_20 = Test-Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727'
if (!$NET_20) {return task NET_20}
$PSVersion = $PSVersionTable.PSVersion
$IsV6Core = $PSVersion.Major -ge 6 -and $PSVersionTable.PSEdition -eq 'Core'
$IsV3Win = $PSVersion.Major -ge 3 -and !$IsV6Core
task Not-current-version -If $IsV3Win {
($r = powershell.exe -Version 2 -Command .\Not-current-version.ps1)
equals $r.Count 2
equals $r[0] "$PSVersion"
equals $r[1] '2.0'
}
task Not-same-exe -If $IsV6Core {
($r = ./Not-same-exe.ps1)
equals $r.Count 2
# fixed in v6-beta.7
# changed in v6-beta.9
assert ($r[0] -ne "$PSVersion")
equals $r[1] "$PSVersion"
}