Skip to content

Commit

Permalink
test: improve functional tests (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmzane authored Apr 27, 2024
1 parent b81d462 commit cfd5719
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
- name: Run functional tests
shell: sh
run: |
echo $PATH
echo $PATH # $GOBIN is already added to $PATH by setup-go.
chmod +x test.sh
./test.sh ${{ matrix.os }}
24 changes: 19 additions & 5 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ if [ "$os" = "windows-latest" ]; then
exe=".exe"
fi

version="1.18"
dump_version() {
file="$1"
hash -r # refresh binary paths
go version | awk '{print $3}' > "$file"
}

go build -o goversion"$exe"

version="1.18"
echo "go$version" > want
dump_version main

echo "Switching to $version"
./goversion"$exe" use "$version"
dump_version got
diff got want

echo "Installed versions"
./goversion"$exe" ls
hash -r # refresh binary paths
go version | awk '{print $3}' > got
echo "go$version" > want
diff got want

echo "Removing $version"
./goversion"$exe" rm "$version"
dump_version got
diff got main

0 comments on commit cfd5719

Please sign in to comment.