Update Go.Tests.ps1

This commit is contained in:
aparnajyothi-y 2024-06-28 16:01:13 +05:30 committed by GitHub
parent 5fadb88d54
commit 0f6d2a4392
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,14 +24,14 @@ Describe "Go" {
}
It "version is correct" {
[version]$Version = $env:VERSION
$versionOutput = Invoke-Expression -Command "go version"
$finalVersion = $Version.ToString(3)
If ($Version.Build -eq "0"){
$finalVersion = $Version.ToString(2)
}
$versionOutput | Should -Match $finalVersion
[version]$Version = $env:VERSION
$versionOutput = (Invoke-Expression -Command "go version") -replace "v", "" # remove "v" prefix
$finalVersion = $Version.ToString(3)
If ($Version.Build -eq "0") {
$finalVersion = $Version.ToString(2)
}
$versionOutput | Should -Match $finalVersion
}
It "is used from tool-cache" {
$goPath = (Get-Command "go").Path