From f85ea7516c1a52e680555c71a42f39f0ef15d7d6 Mon Sep 17 00:00:00 2001 From: Nikita Bykov Date: Mon, 24 Aug 2020 19:28:31 +0300 Subject: [PATCH] fixed tests --- tests/Go.Tests.ps1 | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/tests/Go.Tests.ps1 b/tests/Go.Tests.ps1 index a11fd73..d52d522 100644 --- a/tests/Go.Tests.ps1 +++ b/tests/Go.Tests.ps1 @@ -24,8 +24,12 @@ Describe "Go" { } It "version is correct" { - $versionOutput = Invoke-Expression "go version" - $versionOutput | Should -Match $Version + $versionOutput = Invoke-Expression -Command "go version" + $finalVersion = $Version.ToString(3) + If ($Version.Build -eq "0"){ + $finalVersion = $Version.ToString(2) + } + $versionOutput | Should -Match $finalVersion } It "is used from tool-cache" { @@ -43,6 +47,33 @@ Describe "Go" { $useGoLogFile = Get-UseGoLogs $useGoLogFile | Should -Exist $useGoLogContent = Get-Content $useGoLogFile -Raw - $useGoLogContent | Should -Match "Found cache" + $useGoLogContent | Should -Match "Found in cache" + } + + Set-Location -Path "source" + $sourceLocation = Get-Location + + It "Run simple code" { + $simpleLocation = Join-Path -Path $sourceLocation -ChildPath "simple" + Set-Location -Path $simpleLocation + "go run simple.go" | Should -ReturnZeroExitCode + "go build simple.go" | Should -ReturnZeroExitCode + "./simple" | Should -ReturnZeroExitCode + } + + It "Run maps code" { + $mapsLocation = Join-Path -Path $sourceLocation -ChildPath "maps" + Set-Location -Path $mapsLocation + "go run maps.go" | Should -ReturnZeroExitCode + "go build maps.go" | Should -ReturnZeroExitCode + "./maps" | Should -ReturnZeroExitCode + } + + It "Run methods code" { + $methodsLocation = Join-Path -Path $sourceLocation -ChildPath "methods" + Set-Location -Path $methodsLocation + "go run methods.go" | Should -ReturnZeroExitCode + "go build methods.go" | Should -ReturnZeroExitCode + "./methods" | Should -ReturnZeroExitCode } } \ No newline at end of file