Skip to content

Commit cfd5719

Browse files
authored
test: improve functional tests (#26)
1 parent b81d462 commit cfd5719

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ jobs:
3636
- name: Run functional tests
3737
shell: sh
3838
run: |
39-
echo $PATH
39+
echo $PATH # $GOBIN is already added to $PATH by setup-go.
4040
chmod +x test.sh
4141
./test.sh ${{ matrix.os }}

test.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,27 @@ if [ "$os" = "windows-latest" ]; then
88
exe=".exe"
99
fi
1010

11-
version="1.18"
11+
dump_version() {
12+
file="$1"
13+
hash -r # refresh binary paths
14+
go version | awk '{print $3}' > "$file"
15+
}
16+
1217
go build -o goversion"$exe"
18+
19+
version="1.18"
20+
echo "go$version" > want
21+
dump_version main
22+
1323
echo "Switching to $version"
1424
./goversion"$exe" use "$version"
25+
dump_version got
26+
diff got want
27+
1528
echo "Installed versions"
1629
./goversion"$exe" ls
17-
hash -r # refresh binary paths
18-
go version | awk '{print $3}' > got
19-
echo "go$version" > want
20-
diff got want
30+
31+
echo "Removing $version"
32+
./goversion"$exe" rm "$version"
33+
dump_version got
34+
diff got main

0 commit comments

Comments
 (0)