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

36 lines
1.4 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-10-18 21:14:39 +03:00
$ghcDefaultCases = @{
defaultGhcVersion = $defaultGhcVersion
defaultGhcShortVersion = ([version]$defaultGhcVersion).ToString(3)
}
2020-07-13 11:44:04 +03:00
$ghcTestCases = $ghcVersionList | ForEach-Object {
$ghcVersion = $_
2020-10-18 20:07:40 +03:00
$ghcShortVersion = ([version]$ghcVersion).ToString(3)
2020-07-13 11:44:04 +03:00
@{
2020-10-18 20:52:32 +03:00
ghcVersion = $ghcVersion
ghcShortVersion = $ghcShortVersion
2020-10-18 20:07:40 +03:00
binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcShortVersion\bin\ghc.exe"
2020-07-13 11:44:04 +03:00
}
}
2020-07-10 14:29:54 +03:00
It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} {
$ghcCount | Should -BeExactly 3
}
2020-07-13 11:44:04 +03:00
It "GHC <ghcVersion> is installed" -TestCases $ghcTestCases {
2020-10-18 20:52:32 +03:00
"$binGhcPath --version" | Should -MatchCommandOutput $ghcShortVersion
2020-07-10 14:29:54 +03:00
}
2020-10-18 21:45:48 +03:00
It "GHC <defaultGhcVersion> is the default version and should be the latest installed" -TestCases $ghcDefaultCases {
2020-10-18 20:52:32 +03:00
"ghc --version" | Should -MatchCommandOutput $defaultGhcShortVersion
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
}