From d8dabada57cfbd94b8b1b5ad38c944f2462f6f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=A4=B4?= <3301352378@qq.com> Date: Thu, 9 Jul 2026 15:10:28 +0800 Subject: [PATCH] test: add N13 selector verifier --- scripts/verify-n13-uia-selectors.ps1 | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/verify-n13-uia-selectors.ps1 diff --git a/scripts/verify-n13-uia-selectors.ps1 b/scripts/verify-n13-uia-selectors.ps1 new file mode 100644 index 0000000..0510fd8 --- /dev/null +++ b/scripts/verify-n13-uia-selectors.ps1 @@ -0,0 +1,37 @@ +$ErrorActionPreference = "Stop" +Set-StrictMode -Version Latest + +$repo = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")).Path +Set-Location -LiteralPath $repo + +if (-not (Get-Command go -ErrorAction SilentlyContinue)) { + throw "go was not found. Run this verifier in a Go 1.23.x environment." +} + +Write-Host "## go test ./internal/uiaselector" +go test ./internal/uiaselector -count=1 +if ($LASTEXITCODE -ne 0) { + throw "go test ./internal/uiaselector failed with exit code $LASTEXITCODE" +} + +Write-Host "## boundary grep" +$forbidden = @( + "send_after_approval", + "send_file_after_approval", + "receive_file_after_approval", + "open_conversation", + "ValuePattern.SetValue", + "InvokePattern" +) +$files = @( + "internal\uiaselector\catalog.go", + "internal\uiaselector\matcher.go" +) +foreach ($term in $forbidden) { + $hit = Select-String -LiteralPath $files -Pattern $term -SimpleMatch -ErrorAction SilentlyContinue + if ($hit) { + throw "forbidden action term found in selector implementation: $term" + } +} + +Write-Host "N13 UIA selector verification passed." \ No newline at end of file