Merge pull request #1839 from miketimofeev/fix-haskell-tests-for-revision-versions
[windows] Fix Haskell revision version installation and related tests
This commit is contained in:
@@ -17,7 +17,8 @@ ForEach ($version in $VersionsList)
|
|||||||
|
|
||||||
# Add default version of GHC to path, because choco formula updates path on user level
|
# Add default version of GHC to path, because choco formula updates path on user level
|
||||||
$DefaultGhcVersion = $VersionsList | Select-Object -Last 1
|
$DefaultGhcVersion = $VersionsList | Select-Object -Last 1
|
||||||
$DefaultGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$DefaultGhcVersion\tools\ghc-$DefaultGhcVersion\bin"
|
$DefaultGhcShortVersion = ([version]$DefaultGhcVersion).ToString(3)
|
||||||
|
$DefaultGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$DefaultGhcVersion\tools\ghc-$DefaultGhcShortVersion\bin"
|
||||||
Add-MachinePathItem -PathItem $DefaultGhcPath
|
Add-MachinePathItem -PathItem $DefaultGhcPath
|
||||||
|
|
||||||
Write-Host "Installing cabal..."
|
Write-Host "Installing cabal..."
|
||||||
|
|||||||
@@ -3,12 +3,18 @@ Describe "Haskell" {
|
|||||||
[array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
|
[array]$ghcVersionList = Get-ChildItem -Path $chocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
|
||||||
$ghcCount = $ghcVersionList.Count
|
$ghcCount = $ghcVersionList.Count
|
||||||
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} | Select-Object -Last 1
|
$defaultGhcVersion = $ghcVersionList | Sort-Object {[Version]$_} | Select-Object -Last 1
|
||||||
|
$ghcDefaultCases = @{
|
||||||
|
defaultGhcVersion = $defaultGhcVersion
|
||||||
|
defaultGhcShortVersion = ([version]$defaultGhcVersion).ToString(3)
|
||||||
|
}
|
||||||
|
|
||||||
$ghcTestCases = $ghcVersionList | ForEach-Object {
|
$ghcTestCases = $ghcVersionList | ForEach-Object {
|
||||||
$ghcVersion = $_
|
$ghcVersion = $_
|
||||||
|
$ghcShortVersion = ([version]$ghcVersion).ToString(3)
|
||||||
@{
|
@{
|
||||||
ghcVersion = $ghcVersion
|
ghcVersion = $ghcVersion
|
||||||
binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcVersion\bin\ghc.exe"
|
ghcShortVersion = $ghcShortVersion
|
||||||
|
binGhcPath = Join-Path $chocoPackagesPath "ghc.$ghcVersion\tools\ghc-$ghcShortVersion\bin\ghc.exe"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,11 +23,11 @@ Describe "Haskell" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
It "GHC <ghcVersion> is installed" -TestCases $ghcTestCases {
|
It "GHC <ghcVersion> is installed" -TestCases $ghcTestCases {
|
||||||
"$binGhcPath --version" | Should -MatchCommandOutput $ghcVersion
|
"$binGhcPath --version" | Should -MatchCommandOutput $ghcShortVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
It "GHC <defaultGhcVersion> is the default version and should be the latest installed" -TestCases @{defaultGhcVersion = $defaultGhcVersion} {
|
It "GHC <defaultGhcVersion> is the default version and should be the latest installed" -TestCases $ghcDefaultCases {
|
||||||
"ghc --version" | Should -MatchCommandOutput $defaultGhcVersion
|
"ghc --version" | Should -MatchCommandOutput $defaultGhcShortVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Cabal is installed" {
|
It "Cabal is installed" {
|
||||||
|
|||||||
Reference in New Issue
Block a user