Files
runner-images-sangeeth/images/win/scripts/Tests/Haskell.Test.ps1
2020-07-13 12:10:54 +03:00

33 lines
1.1 KiB
PowerShell

Describe "Haskell" {
It "ghc" {
"ghc --version" | Should -ReturnZeroExitCode
}
It "cabal" {
"cabal --version" | Should -ReturnZeroExitCode
}
$chocoPackagesPath = Join-Path $env:ChocolateyInstall "lib"
[array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
$ghcCount = $ghcVersionList.Count
It "Accurate 3 versions of GHC are installed" -TestCases @{ghcCount = $ghcCount} {
$ghcCount | Should -BeExactly 3
}
$ghcTestCases = $ghcVersionList | ForEach-Object {
@{
ghcVersion = $_
}
}
It "Validation each of GHC version" -TestCases $ghcTestCases {
$binGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe"
& $binGhcPath --version | Should -Match $ghcVersion
}
It "Default version of GHC should be the latest installed" {
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} |Select-Object -Last 1
ghc --version | Should -Match $defaultGhcVersion
}
}