Separate Where-Object comparison parameters and reject malformed native selectors

This commit is contained in:
NINI
2026-10-07 00:22:54 +09:00
parent 913f19c360
commit cc88785e7c
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -55,10 +55,10 @@ try {
Step 'cancel-guide-to-home' @('shell','input','tap','312','108') 3500 Step 'cancel-guide-to-home' @('shell','input','tap','312','108') 3500
CanceledSpeech 'audio-guide-navigation-cancel' 'guide_collect' CanceledSpeech 'audio-guide-navigation-cancel' 'guide_collect'
SelectStage 'cancel-count-enter2' 2 SelectStage 'cancel-count-enter2' 2
$two=Save 'cancel-count-two-initial';$board=@($two.puzzleStates|Where-Object stageId -eq2)[0] $two=Save 'cancel-count-two-initial';$board=@($two.puzzleStates|Where-Object stageId -eq 2)[0]
$s=BallPoint $board $board.groups[0].ballIds[0];$t=BallPoint $board $board.groups[1].ballIds[0] $s=BallPoint $board $board.groups[0].ballIds[0];$t=BallPoint $board $board.groups[1].ballIds[0]
Step 'cancel-count-two-merge' @('shell','input','swipe',"$($s[0])","$($s[1])","$($t[0]-35)","$($t[1])",'500') 3000 Step 'cancel-count-two-merge' @('shell','input','swipe',"$($s[0])","$($s[1])","$($t[0]-35)","$($t[1])",'500') 3000
$two=Save 'cancel-count-two-collected';$board=@($two.puzzleStates|Where-Object stageId -eq2)[0] $two=Save 'cancel-count-two-collected';$board=@($two.puzzleStates|Where-Object stageId -eq 2)[0]
Check 'cancel-count-real2-collected' ($board.groups.Count-eq1-and$board.collectedBallIds.Count-eq2) 'Actual replay2 collected before numeric cancellation' Check 'cancel-count-real2-collected' ($board.groups.Count-eq1-and$board.collectedBallIds.Count-eq2) 'Actual replay2 collected before numeric cancellation'
$p=BallPoint $board $board.balls[0].id $p=BallPoint $board $board.balls[0].id
StartAudio 'audio-numeric-pause-cancel' 12 StartAudio 'audio-numeric-pause-cancel' 12
@@ -76,7 +76,7 @@ try {
$pinch=Save 'free-pinch-state' $pinch=Save 'free-pinch-state'
Check 'native-pinch-zoom-only' ((Same $one.latestFreePlay.balls $pinch.latestFreePlay.balls)-and(Same $one.latestFreePlay.groups $pinch.latestFreePlay.groups)-and$pinch.latestFreePlay.camera.distance-lt$one.latestFreePlay.camera.distance) 'Two physical contacts change zoom, no ball or group mutation' Check 'native-pinch-zoom-only' ((Same $one.latestFreePlay.balls $pinch.latestFreePlay.balls)-and(Same $one.latestFreePlay.groups $pinch.latestFreePlay.groups)-and$pinch.latestFreePlay.camera.distance-lt$one.latestFreePlay.camera.distance) 'Two physical contacts change zoom, no ball or group mutation'
Step 'free-pinch-home' @('shell','input','tap','312','108');SelectStage 'boundary13' 13 Step 'free-pinch-home' @('shell','input','tap','312','108');SelectStage 'boundary13' 13
$thirteen=Save 'boundary13-initial';$board=@($thirteen.puzzleStates|Where-Object stageId -eq13)[0];$point=BallPoint $board $board.groups[0].ballIds[0] $thirteen=Save 'boundary13-initial';$board=@($thirteen.puzzleStates|Where-Object stageId -eq 13)[0];$point=BallPoint $board $board.groups[0].ballIds[0]
TapBall 'boundary13-choose' $board $board.groups[0].ballIds[0];Step 'boundary13-split-mode' @('shell','input','tap','312','832') TapBall 'boundary13-choose' $board $board.groups[0].ballIds[0];Step 'boundary13-split-mode' @('shell','input','tap','312','832')
$confirmed=Save 'boundary13-split-confirmed' $confirmed=Save 'boundary13-split-confirmed'
Step 'boundary13-zero-selected-drag' @('shell','input','swipe',"$($point[0])","$($point[1])","$($point[0]-190)","$($point[1])",'500') Step 'boundary13-zero-selected-drag' @('shell','input','swipe',"$($point[0])","$($point[1])","$($point[0]-190)","$($point[1])",'500')
+3 -2
View File
@@ -4,8 +4,9 @@ New-Item -ItemType Directory -Path $EvidenceDir -Force|Out-Null
if(!$Sources){$Sources=@(Get-ChildItem $PSScriptRoot -Filter '*.ps1'|Select-Object -ExpandProperty FullName)} if(!$Sources){$Sources=@(Get-ChildItem $PSScriptRoot -Filter '*.ps1'|Select-Object -ExpandProperty FullName)}
$results=@(foreach($source in $Sources){ $results=@(foreach($source in $Sources){
$errors=$null $errors=$null
[Management.Automation.Language.Parser]::ParseFile($source,[ref]$null,[ref]$errors)|Out-Null $ast=[Management.Automation.Language.Parser]::ParseFile($source,[ref]$null,[ref]$errors)
@{source=$source;passed=($errors.Count-eq0);errors=@($errors|Select-Object ErrorId,Message,@{n='line';e={$_.Extent.StartLineNumber}})} $malformed=@($ast.FindAll({param($n)$n-is[Management.Automation.Language.CommandParameterAst]-and$n.ParameterName-match'^(eq|ne|gt|lt|ge|le)\d+$'},$true)|ForEach-Object{$_.Extent.Text})
@{source=$source;passed=($errors.Count-eq0-and$malformed.Count-eq0);malformedOperatorParameters=$malformed;errors=@($errors|Select-Object ErrorId,Message,@{n='line';e={$_.Extent.StartLineNumber}})}
}) })
$passed=$results.Count-gt0-and@($results|Where-Object passed -ne $true).Count-eq0 $passed=$results.Count-gt0-and@($results|Where-Object passed -ne $true).Count-eq0
@{passed=$passed;checks=$results}|ConvertTo-Json -Depth 8|Set-Content (Join-Path $EvidenceDir 'syntax-result.json') @{passed=$passed;checks=$results}|ConvertTo-Json -Depth 8|Set-Content (Join-Path $EvidenceDir 'syntax-result.json')