Files
ARCADIA-Studio/harness/experiments/scenario-label-fields-4c9bc87-20260913/original/validate-syntax.ps1
T

15 lines
1.3 KiB
PowerShell

#Requires -Version 7.0
# Static recipe validation only. This does not invoke the compiler or test binary.
Set-StrictMode -Version Latest
$ErrorActionPreference='Stop'
foreach($name in @('build.ps1','run.ps1','validate-syntax.ps1')){
$tokens=$null;$errors=$null
[void][System.Management.Automation.Language.Parser]::ParseFile((Join-Path $PSScriptRoot $name),[ref]$tokens,[ref]$errors)
if(@($errors).Count){throw (($errors|ForEach-Object {$name+': '+$_.Message}) -join [Environment]::NewLine)}
}
$expected=Get-Content -LiteralPath (Join-Path $PSScriptRoot 'expected-tests.json') -Raw|ConvertFrom-Json
$recipe=Get-Content -LiteralPath (Join-Path $PSScriptRoot 'recipe.json') -Raw|ConvertFrom-Json
if($expected.source_commit -cne $recipe.source_commit -or @($expected.tests).Count -ne 25 -or @($expected.normal).Count -ne 21 -or @($expected.isolated).Count -ne 4 -or @($expected.tests|Sort-Object -Unique).Count -ne 25 -or (Compare-Object ($expected.tests|Sort-Object) (@($expected.normal)+@($expected.isolated)|Sort-Object))){throw 'Expected source or test partition differs'}
foreach($name in @('font','ffi','auto-transition','timing')){if($expected.stages.$name -cnotin $expected.isolated){throw ('Stage is not an isolated test: '+$name)}}
Write-Output 'PowerShell syntax and 25-test partition valid; no compiler or tests executed.'