@@ -13,6 +13,11 @@ setup() {
1313 ' done'
1414 export __GO_ETC_OS_RELEASE=" $BATS_TEST_ROOTDIR /os-release"
1515
16+ stub_program_in_path ' sw_vers' \
17+ ' if [[ "$*" == "-productVersion" ]]; then' \
18+ ' printf "$TEST_MACOS_VERSION\n"' \
19+ ' fi'
20+
1621 stub_program_in_path ' uname' \
1722 ' if [[ "$*" == "-r" ]]; then' \
1823 ' printf "$TEST_UNAME_VERSION\n"' \
@@ -25,7 +30,7 @@ setup() {
2530}
2631
2732teardown () {
28- restore_programs_in_path ' git' ' uname'
33+ restore_programs_in_path ' git' ' uname' ' sw_vers '
2934 @go.remove_test_go_rootdir
3035}
3136
@@ -57,12 +62,13 @@ teardown() {
5762 ' _GO_PLATFORM_VERSION_ID="3.27"'
5863}
5964
60- @test " $SUITE : macos _GO_PLATFORM_{ID,VERSION_ID} from OSTYPE, uname -r" {
61- OSTYPE=' darwin16.3.0' TEST_UNAME_VERSION=' 17.0.0' run " $TEST_GO_SCRIPT "
65+ @test " $SUITE : macos _GO_PLATFORM_{ID,VERSION_ID} from OSTYPE, sw_vers" {
66+ OSTYPE=' darwin16.3.0' TEST_UNAME_VERSION=' 17.0.0' \
67+ TEST_MACOS_VERSION=' 10.13' run " $TEST_GO_SCRIPT "
6268 assert_success
6369 assert_lines_equal \
6470 ' _GO_PLATFORM_ID="macos"' \
65- ' _GO_PLATFORM_VERSION_ID="17.0.0 "'
71+ ' _GO_PLATFORM_VERSION_ID="10.13 "'
6672}
6773
6874@test " $SUITE : freebsd _GO_PLATFORM_{ID,VERSION_ID} from OSTYPE, uname -r" {
0 commit comments