diff --git a/test/plugins/go.plugin.bats b/test/plugins/go.plugin.bats index 379a935e..ea1f528e 100644 --- a/test/plugins/go.plugin.bats +++ b/test/plugins/go.plugin.bats @@ -5,14 +5,38 @@ load ../../lib/helpers load ../../lib/composure load ../../plugins/available/go.plugin +function local_setup { + mkdir -p "$BASH_IT" + lib_directory="$(cd "$(dirname "$0")" && pwd)" + # Use rsync to copy Bash-it to the temp folder + # rsync is faster than cp, since we can exclude the large ".git" folder + rsync -qavrKL -d --delete-excluded --exclude=.git $lib_directory/../../.. "$BASH_IT" + + rm -rf "$BASH_IT"/enabled + rm -rf "$BASH_IT"/aliases/enabled + rm -rf "$BASH_IT"/completion/enabled + rm -rf "$BASH_IT"/plugins/enabled + + mkdir -p "$BASH_IT"/enabled + mkdir -p "$BASH_IT"/aliases/enabled + mkdir -p "$BASH_IT"/completion/enabled + mkdir -p "$BASH_IT"/plugins/enabled + + export OLD_PATH="$PATH" + export PATH="/usr/bin:/bin:/usr/sbin" +} + +function local_teardown { + export PATH="$OLD_PATH" + unset OLD_PATH +} @test 'plugins go: single entry in GOPATH' { export GOROOT='/baz' export GOPATH='/foo' load ../../plugins/available/go.plugin - assert_equal $PATH 'foobar' - assert_equal $(cut -d':' -f1,2 <<<$PATH | tr -d '\n') '/foo/bin:/baz/bin' + assert_equal $(cut -d':' -f1,2 <<<$PATH) '/foo/bin:/baz/bin' } @test 'plugins go: single entry in GOPATH, with space' {