[Windows] Refactor test helpers (#8889)

This commit is contained in:
Vasilii Polikarpov
2023-11-27 11:37:49 +01:00
committed by GitHub
parent 79c347765a
commit 9492109c62
5 changed files with 96 additions and 81 deletions

View File

@@ -28,13 +28,13 @@ Describe "Java" {
$javaVariableValue | Should -Not -BeNullOrEmpty
$javaPath = Join-Path $javaVariableValue "bin\java"
$result = Get-CommandResult "`"$javaPath`" -version"
$result.ExitCode | Should -Be 0
if ($Version -eq 8) {
$Version = "1.${Version}"
}
$outputPattern = "openjdk version `"${Version}"
$result.Output[0] | Should -Match $outputPattern
$outputLines = (& $env:comspec /c "`"$javaPath`" -version 2>&1") -as [string[]]
$LASTEXITCODE | Should -Be 0
$outputLines[0] | Should -Match $outputPattern
}
}