Files
runner-images/images/win/scripts/Tests/Haskell.Tests.ps1
T

30 lines
1.2 KiB
PowerShell
Raw Normal View History

2020-07-10 14:29:54 +03:00
Describe "Haskell" {
$chocoPackagesPath = Join-Path $env:ChocolateyInstall "lib"
[array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
$ghcCount = $ghcVersionList.Count
2020-07-13 11:44:04 +03:00
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} | Select-Object -Last 1
2020-07-10 14:29:54 +03:00
$ghcTestCases = $ghcVersionList | ForEach-Object {
2020-07-13 11:44:04 +03:00
$ghcVersion = $_
2020-07-10 14:29:54 +03:00
@{
2020-07-13 11:44:04 +03:00
ghcVersion = $ghcVersion
binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe"
2020-07-10 14:29:54 +03:00
}
}
2020-07-13 11:44:04 +03:00
It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} {
$ghcCount | Should -BeExactly 3
}
It "GHC <ghcVersion> is installed" -TestCases $ghcTestCases {
2020-07-13 13:37:04 +03:00
"$binGhcPath --version" | Should -MatchCommandOutput $ghcVersion
2020-07-10 14:29:54 +03:00
}
2020-07-13 11:44:04 +03:00
It "GHC <defaultGhcVersion> is the default version and should be the latest installed" -TestCases @{defaultGhcVersion = $defaultGhcVersion} {
2020-07-13 13:37:04 +03:00
"ghc --version" | Should -MatchCommandOutput $defaultGhcVersion
2020-07-10 14:29:54 +03:00
}
2020-07-13 11:44:04 +03:00
It "Cabal is installed" {
"cabal --version" | Should -ReturnZeroExitCode
}
2020-07-10 14:29:54 +03:00
}