[macOS] Update condition for mono test case (#11515)

This commit is contained in:
sarathrajsrinivasan
2025-01-31 11:45:21 -06:00
committed by GitHub
parent 8273c96ed0
commit 002f86637a

View File

@@ -14,61 +14,63 @@ BeforeAll {
} }
} }
Describe "Mono" -Skip:($os.IsSequoia) { if ($os.IsVentura -or $os.IsSonoma) {
$MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" Describe "Mono" {
$monoToolsetVersion = @((Get-ToolsetContent).mono.framework.version) $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions"
$versionFolderPath = Join-Path $MONO_VERSIONS_PATH ([System.Version]::Parse($monoToolsetVersion).ToString(3)) $monoToolsetVersion = @((Get-ToolsetContent).mono.framework.version)
$testCase = @{ MonoVersion = $monoToolsetVersion; VersionFolderPath = $versionFolderPath; MonoVersionsPath = $MONO_VERSIONS_PATH } $versionFolderPath = Join-Path $MONO_VERSIONS_PATH ([System.Version]::Parse($monoToolsetVersion).ToString(3))
$testCase = @{ MonoVersion = $monoToolsetVersion; VersionFolderPath = $versionFolderPath; MonoVersionsPath = $MONO_VERSIONS_PATH }
It "is installed" -TestCases $testCase { It "is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath ) param ( [string] $VersionFolderPath )
$monoBinPath = Join-Path $VersionFolderPath "bin" "mono" $monoBinPath = Join-Path $VersionFolderPath "bin" "mono"
$VersionFolderPath | Should -Exist $VersionFolderPath | Should -Exist
$monoBinPath | Should -Exist $monoBinPath | Should -Exist
} }
It "is available via short link" -TestCases $testCase { It "is available via short link" -TestCases $testCase {
param ( param (
[string] $MonoVersion, [string] $MonoVersion,
[string] $MonoVersionsPath, [string] $MonoVersionsPath,
[string] $VersionFolderPath [string] $VersionFolderPath
) )
$shortSymlink = Get-ShortSymlink $MonoVersion # only 'major.minor' $shortSymlink = Get-ShortSymlink $MonoVersion # only 'major.minor'
$shortSymlinkFolderPath = Join-Path $MonoVersionsPath $shortSymlink $shortSymlinkFolderPath = Join-Path $MonoVersionsPath $shortSymlink
if ($shortSymlink -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file if ($shortSymlink -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file
$shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION"
$fullVersionPath = Join-Path $VersionFolderPath "VERSION" $fullVersionPath = Join-Path $VersionFolderPath "VERSION"
Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath Confirm-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath
} }
It "NUnit console is installed" -TestCases $testCase { It "NUnit console is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath ) param ( [string] $VersionFolderPath )
$nunitPath = Join-Path $VersionFolderPath "Commands" "nunit3-console" $nunitPath = Join-Path $VersionFolderPath "Commands" "nunit3-console"
$nunitPath | Should -Exist $nunitPath | Should -Exist
} }
It "Nuget is installed" -TestCases $testCase { It "Nuget is installed" -TestCases $testCase {
param ( [string] $VersionFolderPath ) param ( [string] $VersionFolderPath )
$nugetBinaryPath = Join-Path $VersionFolderPath "lib" "mono" "nuget" "nuget.exe" $nugetBinaryPath = Join-Path $VersionFolderPath "lib" "mono" "nuget" "nuget.exe"
$nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget"
$nugetCommandPath = Join-Path $VersionFolderPath "Commands" "nuget" $nugetCommandPath = Join-Path $VersionFolderPath "Commands" "nuget"
$nugetBinaryPath | Should -Exist $nugetBinaryPath | Should -Exist
$nugetCommandPath | Should -Exist $nugetCommandPath | Should -Exist
$nugetBinaryWrapperPath | Should -Exist $nugetBinaryWrapperPath | Should -Exist
} }
It "Nuget is valid" -TestCases $testCase { It "Nuget is valid" -TestCases $testCase {
param ( [string] $VersionFolderPath ) param ( [string] $VersionFolderPath )
$nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget"
"$nugetBinaryWrapperPath" | Should -ReturnZeroExitCode "$nugetBinaryWrapperPath" | Should -ReturnZeroExitCode
} }
It "MSBuild is available" { It "MSBuild is available" {
"msbuild -version" | Should -ReturnZeroExitCode "msbuild -version" | Should -ReturnZeroExitCode
}
} }
} }