File: make_msi_test.ps1

package info (click to toggle)
bazel-bootstrap 4.2.3%2Bds-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 85,704 kB
  • sloc: java: 721,717; sh: 55,859; cpp: 35,360; python: 12,139; xml: 295; objc: 269; makefile: 113; ansic: 106; ruby: 3
file content (46 lines) | stat: -rwxr-xr-x 1,492 bytes parent folder | download | duplicates (3)
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
40
41
42
43
44
45
46
Import-Module .\scripts\packages\msi\make_msi_lib.ps1

function Assert-Equal {
    param (
        [Parameter(Position = 0)][string]$x,
        [Parameter(Position = 1)][string]$y
    )
    if ($x -ne $y) {
        throw "Expected equality of ($x) and ($y)"
    }
}

function Assert-NotEqual {
    param (
        [Parameter(Position = 0)][string]$x,
        [Parameter(Position = 1)][string]$y
    )
    if ($x -eq $y) {
        throw "Expected non-equality of ($x) and ($y)"
    }
}

# Tests for Replace-Slashes
Assert-Equal $(Replace-Slashes "") ""
Assert-Equal $(Replace-Slashes 'foo') 'foo'
Assert-Equal $(Replace-Slashes 'foo/bar/baz\qux') 'foo\bar\baz\qux'

# Test for Compute-RelaseNameAndVersion
$rel, $ver = Compute-RelaseNameAndVersion 'bazel-1.2.3-windows-x86_64.exe'
Assert-Equal $rel '1.2.3'
Assert-Equal $ver '1.2.3'
$rel, $ver = Compute-RelaseNameAndVersion 'bazel-0.99.5rc3-windows-x86_64.exe'
Assert-Equal $rel '0.99.5rc3'
Assert-Equal $ver '0.99.5'

# Test for Get-UpgradeGuid
Assert-Equal $(Get-UpgradeGuid 0.28.0) 'B7864F52-FA13-402E-8334-5CF8FE168728'
Assert-Equal $(Get-UpgradeGuid 1.0.0) $(Get-UpgradeGuid 1.0.5)
Assert-Equal $(Get-UpgradeGuid 1.0.0) $(Get-UpgradeGuid 1.0.5rc2)
Assert-Equal $(Get-UpgradeGuid 1.0.0) $(Get-UpgradeGuid 1.3.3)
Assert-Equal $(Get-UpgradeGuid 2.1.0) $(Get-UpgradeGuid 2.0.3rc1)
Assert-NotEqual $(Get-UpgradeGuid 0.28.0) $(Get-UpgradeGuid 0.29.0)
Assert-NotEqual $(Get-UpgradeGuid 1.5.0) $(Get-UpgradeGuid 2.0.3rc1)


Log-Info 'PASSED'