#!/bin/bash
# Evidence: file open routes a real HTS file to the responsible HTS VS Code workspace window.

powershell.exe -Command "$ErrorActionPreference='Stop'; Start-Sleep -Seconds 31; \$target = 'D:\HTS_Project\Source\RunControls\ScGridCheCtl\ScCtlGridChe.cpp:5352'; \$out = & 'D:\SDK\bin\wkappbot-core.exe' file open \$target 2>&1 | Out-String; if (\$LASTEXITCODE -ne 0) { Write-Host 'FAIL: file open exited non-zero'; Write-Host \$out; exit 1 }; if (\$out -notmatch 'cwd=D:\\HTS_Project\\Source\\RunControls\\ScGridCheCtl') { Write-Host 'FAIL: missing responsible HTS workspace target'; Write-Host \$out; exit 1 }; if (\$out -notmatch 'ScCtlGridChe\.cpp:5352') { Write-Host 'FAIL: missing goto success for HTS file'; Write-Host \$out; exit 1 }; if (\$out -match 'falling back to code\.exe') { Write-Host 'FAIL: fell back instead of using matched HTS workspace'; Write-Host \$out; exit 1 }; Write-Host 'PASS: HTS workspace window selected'; Write-Host 'PASS: requested HTS file/line routed through file open'; Write-Host 'ALL PASS';"
