Skip to content

Commit 1cb75cd

Browse files
committed
template: Fix Windows/MSYS2 test failure
On MSYS2, `/tmp` (used in `TEST_GO_ROOTDIR` via `BATS_TMPDIR`) is mapped to `C:/Users/<user>/AppData/Local/Temp/`. When `git clone ... ` is called with a path starting with `/tmp`, its output show the `C:/Users/...` path instead. The fix is to update the `assert_output_matches` expression to match only the `scripts/go-script-bash` suffix of the clone path instead of the entire path.
1 parent a454f98 commit 1cb75cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/template.bats

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
load environment
44

5-
TEST_CLONE_DIR="$TEST_GO_ROOTDIR/scripts/go-script-bash"
6-
75
setup() {
86
test_filter
97
mkdir "$TEST_GO_ROOTDIR"
@@ -39,7 +37,10 @@ create_template_script() {
3937
# return an error, but the core repo should exist as expected.
4038
assert_failure
4139
assert_output_matches "Cloning framework from '$_GO_CORE_DIR'\.\.\."
42-
assert_output_matches "Cloning into '$TEST_CLONE_DIR'\.\.\."
40+
41+
# Use `.*/scripts/go-script-bash` to account for the fact that `git clone` on
42+
# MSYS2 will output `C:/Users/<user>/AppData/Local/Temp/` in place of `/tmp`.
43+
assert_output_matches "Cloning into '.*/scripts/go-script-bash'\.\.\."
4344
assert_output_matches "Clone of '$_GO_CORE_DIR' successful\."$'\n\n'
4445
assert_output_matches "Usage: $TEST_GO_ROOTDIR/go-template <command>"
4546
[[ -f "$TEST_GO_ROOTDIR/scripts/go-script-bash/go-core.bash" ]]

0 commit comments

Comments
 (0)