Added a condition for the $binGhcPath to not depend on the exact Haskell version (#3537)

This commit is contained in:
Mikhail Timofeev
2021-06-07 20:49:36 +03:00
committed by GitHub
parent 638ad60fbd
commit 395eb43c2b

View File

@@ -12,8 +12,8 @@ Describe "Haskell" {
$ghcVersion = $_
$ghcShortVersion = ([version]$ghcVersion).ToString(3)
$binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcShortVersion\bin\ghc.exe"
# Starting from version 9 haskell installation directory is $env:ChocolateyToolsLocation instead of $env:ChocolateyInstall\lib
if ($ghcVersion -notmatch "^[0-8]\.\d+.*")
# The most recent GHC versions installation directory is $env:ChocolateyToolsLocation instead of $env:ChocolateyInstall\lib
if (-not (Test-Path $binGhcPath))
{
$binGhcPath = Join-Path $env:ChocolateyToolsLocation "ghc-$ghcShortVersion\bin\ghc.exe"
}
@@ -36,11 +36,6 @@ Describe "Haskell" {
"ghc --version" | Should -MatchCommandOutput $defaultGhcShortVersion
}
# Sometimes choco doesn't return version 9, need to check it explicitly https://github.com/chocolatey/choco/issues/2271
It "Default GHC version is 9" -TestCases $ghcDefaultCases {
"ghc --version" | Should -MatchCommandOutput "9(\.\d+){2,}"
}
It "Cabal is installed" {
"cabal --version" | Should -ReturnZeroExitCode
}