Skip to content

Commit 50a9455

Browse files
shanselmanCopilot
andauthored
Fix Windows PowerShell packaging test parser (#1134)
Replace encoding-sensitive Unicode punctuation and box drawing with ASCII equivalents so Windows PowerShell 5.1 parses the packaging test reliably. Co-authored-by: Copilot App <[email protected]>
1 parent b5925f0 commit 50a9455

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

‎tests/PackagingTests/Test-InnoUninstallOrdering.ps1‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<#
22
.SYNOPSIS
3-
Packaging test — verifies that Inno Setup's [UninstallRun] entry for
3+
Packaging test - verifies that Inno Setup's [UninstallRun] entry for
44
Uninstall-LocalGateway.ps1 runs BEFORE {app} directory deletion.
55
66
.DESCRIPTION
@@ -153,7 +153,7 @@ function Add-Step {
153153
"Info" { "Cyan" }
154154
default { "White" }
155155
}
156-
Write-Host "[$ts] [$Status] $Name — $Message" -ForegroundColor $color
156+
Write-Host "[$ts] [$Status] $Name - $Message" -ForegroundColor $color
157157
}
158158

159159
function Write-Info {
@@ -216,11 +216,11 @@ function Write-Results {
216216
default { "Yellow" }
217217
}
218218
Write-Host ""
219-
Write-Host "════════════════════════════════════════" -ForegroundColor $verdictColor
219+
Write-Host "========================================" -ForegroundColor $verdictColor
220220
Write-Host " VERDICT : $Verdict" -ForegroundColor $verdictColor
221221
Write-Host " ExitCode : $ExitCode" -ForegroundColor $verdictColor
222222
Write-Host " Output : $OutputDir" -ForegroundColor $verdictColor
223-
Write-Host "════════════════════════════════════════" -ForegroundColor $verdictColor
223+
Write-Host "========================================" -ForegroundColor $verdictColor
224224
Write-Host ""
225225
}
226226

@@ -233,7 +233,7 @@ function Find-Installer {
233233
return $InstallerPath
234234
}
235235

236-
# Script is in tests\PackagingTests\ → repo root is 3 levels up
236+
# Script is in tests\PackagingTests\ -> repo root is 3 levels up
237237
$repoRoot = Split-Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Parent
238238
$candidates = @(
239239
(Join-Path $repoRoot "Output\OpenClawTray-Setup-x64.exe"),
@@ -326,11 +326,11 @@ function Test-UninstallLogOrdering {
326326
dir_deleted = $dirDeleted
327327
ordering_correct = $orderingOk
328328
notes = if ($orderingOk) {
329-
"hook at line $hookIdx < dir-delete at line $dirDelIdx — ordering CORRECT"
329+
"hook at line $hookIdx < dir-delete at line $dirDelIdx - ordering CORRECT"
330330
} elseif (-not $hookRan) {
331-
"hook entry not found in log — [UninstallRun] may not have run"
331+
"hook entry not found in log - [UninstallRun] may not have run"
332332
} elseif (-not $dirDeleted) {
333-
"dir-delete entry not found in log — check Inno verbosity"
333+
"dir-delete entry not found in log - check Inno verbosity"
334334
} else {
335335
"ORDERING WRONG: hook at line $hookIdx >= dir-delete at line $dirDelIdx"
336336
}
@@ -370,10 +370,10 @@ $script:tempInstallPath = ""
370370
$script:appDirPattern = ""
371371

372372
Write-Host ""
373-
Write-Host "╔══════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
374-
Write-Host "║ Test-InnoUninstallOrdering.ps1 (2026-05-07) ║" -ForegroundColor Cyan
375-
Write-Host "║ Verifies [UninstallRun] hook runs BEFORE {app} deletion ║" -ForegroundColor Cyan
376-
Write-Host "╚══════════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
373+
Write-Host "================================================================" -ForegroundColor Cyan
374+
Write-Host " Test-InnoUninstallOrdering.ps1 (2026-05-07)" -ForegroundColor Cyan
375+
Write-Host " Verifies [UninstallRun] hook runs BEFORE {app} deletion" -ForegroundColor Cyan
376+
Write-Host "================================================================" -ForegroundColor Cyan
377377
Write-Host " OutputDir : $OutputDir"
378378
Write-Host ""
379379

@@ -382,7 +382,7 @@ $exitCode = $EXIT_ERROR
382382
try {
383383

384384
# =====================================================================
385-
# STEP 1 — Locate installer
385+
# STEP 1 - Locate installer
386386
# =====================================================================
387387
$foundInstaller = Find-Installer
388388
if ([string]::IsNullOrEmpty($foundInstaller)) {
@@ -402,7 +402,7 @@ try {
402402
Write-Info "Installer: $foundInstaller"
403403

404404
# =====================================================================
405-
# STEP 2 — Create a temp install prefix
405+
# STEP 2 - Create a temp install prefix
406406
# =====================================================================
407407
if ([string]::IsNullOrEmpty($TempInstallDir)) {
408408
$TempInstallDir = Join-Path $env:TEMP "InnoOrderingTest"
@@ -417,7 +417,7 @@ try {
417417
Write-Info "Temp install dir: $tempInstallPath"
418418

419419
# =====================================================================
420-
# STEP 3 — Silent install
420+
# STEP 3 - Silent install
421421
# =====================================================================
422422
Write-Info "Running silent install..."
423423
$installLog = Join-Path $OutputDir "install.log"
@@ -444,7 +444,7 @@ try {
444444
}
445445

446446
# =====================================================================
447-
# STEP 4 — Verify post-install file presence
447+
# STEP 4 - Verify post-install file presence
448448
# =====================================================================
449449
$exePath = Join-Path $tempInstallPath "OpenClaw.Tray.WinUI.exe"
450450
$hookScriptPath = Join-Path $tempInstallPath "Uninstall-LocalGateway.ps1"
@@ -468,7 +468,7 @@ try {
468468
}
469469

470470
# =====================================================================
471-
# STEP 5 — Locate unins000.exe
471+
# STEP 5 - Locate unins000.exe
472472
# =====================================================================
473473
$uninsExe = Join-Path $tempInstallPath "unins000.exe"
474474
if (-not (Test-Path -LiteralPath $uninsExe)) {
@@ -485,7 +485,7 @@ try {
485485
Add-Step "locate-uninstaller" "Passed" "Uninstaller: $uninsExe"
486486

487487
# =====================================================================
488-
# STEP 6 — Silent uninstall with log capture
488+
# STEP 6 - Silent uninstall with log capture
489489
# =====================================================================
490490
$uninstallLog = Join-Path $OutputDir "uninstall.log"
491491
$uninstallArgs = @('/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART',
@@ -511,7 +511,7 @@ try {
511511
}
512512

513513
# =====================================================================
514-
# STEP 7 — Parse log: verify hook ran AND ordering is correct
514+
# STEP 7 - Parse log: verify hook ran AND ordering is correct
515515
# =====================================================================
516516
Write-Info "Parsing uninstall log for ordering evidence..."
517517
$ordering = Test-UninstallLogOrdering -LogPath $uninstallLog
@@ -535,7 +535,7 @@ try {
535535
}
536536

537537
# =====================================================================
538-
# STEP 7b — Supplemental: verify {app} dir was deleted after uninstall
538+
# STEP 7b - Supplemental: verify {app} dir was deleted after uninstall
539539
# =====================================================================
540540
$appDirGone = -not (Test-Path -LiteralPath $tempInstallPath)
541541
if ($appDirGone) {
@@ -546,12 +546,12 @@ try {
546546
}
547547

548548
# =====================================================================
549-
# STEP 8 — WSL cleanup check
549+
# STEP 8 - WSL cleanup check
550550
# =====================================================================
551551
Invoke-WslCleanupCheck
552552

553553
# =====================================================================
554-
# STEP 9 — Final verdict
554+
# STEP 9 - Final verdict
555555
# =====================================================================
556556

557557
# Determine if the log ordering check was conclusive.
@@ -618,7 +618,7 @@ finally {
618618
Write-Info "Temp install dir removed: $($script:tempInstallPath)"
619619
}
620620
catch {
621-
Write-Info "Warning: could not remove temp dir: $($script:tempInstallPath) — $($_.Exception.Message)"
621+
Write-Info "Warning: could not remove temp dir: $($script:tempInstallPath) - $($_.Exception.Message)"
622622
}
623623
}
624624
}

0 commit comments

Comments
 (0)