test/plugins/go: Skip tests in absence of `go`

In case `go` is not installed, tests of the according plugin fail. It's
better to just skip them since `golang` isn't commonly installed on
`bash-it` developers' machines.

In CI environment, no tests should be skipped, so run them anyway.
pull/1554/head
Alex Thiessen 2020-04-09 23:40:59 +00:00
parent cb1490fe66
commit c003f0f342
No known key found for this signature in database
GPG Key ID: 6C90AE2B18A1CF5B
1 changed files with 7 additions and 0 deletions

View File

@ -5,12 +5,14 @@ load ../../lib/helpers
load ../../lib/composure load ../../lib/composure
@test 'ensure _go_pathmunge_wrap is defined' { @test 'ensure _go_pathmunge_wrap is defined' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
run type -t _go_pathmunge_wrap run type -t _go_pathmunge_wrap
assert_line 'function' assert_line 'function'
} }
@test 'plugins go: single entry in GOPATH' { @test 'plugins go: single entry in GOPATH' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
export GOPATH="/foo" export GOPATH="/foo"
export GOROOT="/baz" export GOROOT="/baz"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
@ -18,6 +20,7 @@ load ../../lib/composure
} }
@test 'plugins go: single entry in GOPATH, with space' { @test 'plugins go: single entry in GOPATH, with space' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
export GOPATH="/foo bar" export GOPATH="/foo bar"
export GOROOT="/baz" export GOROOT="/baz"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
@ -25,6 +28,7 @@ load ../../lib/composure
} }
@test 'plugins go: single entry in GOPATH, with escaped space' { @test 'plugins go: single entry in GOPATH, with escaped space' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
export GOPATH="/foo\ bar" export GOPATH="/foo\ bar"
export GOROOT="/baz" export GOROOT="/baz"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
@ -32,6 +36,7 @@ load ../../lib/composure
} }
@test 'plugins go: multiple entries in GOPATH' { @test 'plugins go: multiple entries in GOPATH' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
export GOPATH="/foo:/bar" export GOPATH="/foo:/bar"
export GOROOT="/baz" export GOROOT="/baz"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
@ -39,6 +44,7 @@ load ../../lib/composure
} }
@test 'plugins go: multiple entries in GOPATH, with space' { @test 'plugins go: multiple entries in GOPATH, with space' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
export GOPATH="/foo:/foo bar" export GOPATH="/foo:/foo bar"
export GOROOT="/baz" export GOROOT="/baz"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin
@ -46,6 +52,7 @@ load ../../lib/composure
} }
@test 'plugins go: multiple entries in GOPATH, with escaped space' { @test 'plugins go: multiple entries in GOPATH, with escaped space' {
{ [[ $CI ]] || _command_exists go; } || skip 'golang not found'
export GOPATH="/foo:/foo\ bar" export GOPATH="/foo:/foo\ bar"
export GOROOT="/baz" export GOROOT="/baz"
load ../../plugins/available/go.plugin load ../../plugins/available/go.plugin