Skip to content

Commit 6ecbc29

Browse files
committed
Make test.sh works on macOS
1 parent 86b6390 commit 6ecbc29

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

test.sh

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#! /bin/bash
22
set -o errexit -o pipefail -o nounset
33

4-
run() {
4+
run() (
55
echo >&2
66
echo "exec> $*" >&2
77
"$@"
8-
}
8+
)
99

10-
skip() {
10+
skip() (
1111
echo >&2
1212
echo "skip> $*" >&2
13-
}
13+
)
1414

15-
run_if() {
15+
run_if() (
1616
condition="$1"
1717
shift
1818
case "$condition" in
@@ -23,23 +23,21 @@ run_if() {
2323
exit 1
2424
;;
2525
esac
26-
}
26+
)
2727

28-
flags=("$@")
29-
build_flags=()
30-
test_flags=()
31-
eval "build_flags+=(${BUILD_FLAGS:-})"
32-
eval "test_flags+=(${TEST_FLAGS:-})"
33-
unit() {
34-
arguments=("$@" "${flags[@]}")
35-
run_if "${LINT:-true}" cargo clippy "${arguments[@]}" -- -D warnings
36-
run_if "${BUILD:-true}" cargo build "${build_flags[@]}" "${arguments[@]}"
37-
run_if "${TEST:-true}" cargo test "${test_flags[@]}" "${arguments[@]}"
38-
}
28+
unit() (
29+
build_flags=()
30+
test_flags=()
31+
eval "build_flags+=(${BUILD_FLAGS:-})"
32+
eval "test_flags+=(${TEST_FLAGS:-})"
33+
run_if "${LINT:-true}" cargo clippy "$@" -- -D warnings
34+
run_if "${BUILD:-true}" cargo build "${build_flags[@]}" "$@"
35+
run_if "${TEST:-true}" cargo test "${test_flags[@]}" "$@"
36+
)
3937

4038
run_if "${FMT:-true}" cargo fmt
41-
unit
42-
unit --no-default-features
43-
unit --all-features
44-
unit --features cli
45-
unit --features cli-completions
39+
unit "$@"
40+
unit --no-default-features "$@"
41+
unit --all-features "$@"
42+
unit --features cli "$@"
43+
unit --features cli-completions "$@"

0 commit comments

Comments
 (0)