diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/cli-opts.sh | 2 | ||||
-rwxr-xr-x | tests/lib.sh | 8 | ||||
-rwxr-xr-x | tests/ranking.sh | 10 |
3 files changed, 14 insertions, 6 deletions
diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh index cca2228..efc100b 100755 --- a/tests/cli-opts.sh +++ b/tests/cli-opts.sh @@ -73,7 +73,7 @@ test_valid_options() { ERR="$(mktemp)" printf 'a\nb\nc\n' | \ sh remembering \ - -p "always-unique-$(uuidgen)" \ + -p "always-unique-$(uuid)" \ -c 'head -n1' \ 1>"$OUT" 2>"$ERR" STATUS=$? diff --git a/tests/lib.sh b/tests/lib.sh index efc9368..f7f4415 100755 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -27,3 +27,11 @@ assert_stdout() { exit 1 fi } + +uuid() { + # Taken from: + # https://serverfault.com/a/799198 + od -x /dev/urandom | \ + head -1 | \ + awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' +} diff --git a/tests/ranking.sh b/tests/ranking.sh index 4d8a7e7..5dec051 100755 --- a/tests/ranking.sh +++ b/tests/ranking.sh @@ -6,7 +6,7 @@ set -eu test_picking_first_makes_it_be_always_first() { OUT="$(mktemp)" ERR="$(mktemp)" - PROFILE="always-picks-first-$(uuidgen)" + PROFILE="always-picks-first-$(uuid)" for _ in $(seq 10); do printf 'always-picked\nnever-picked\n' | \ sh remembering \ @@ -71,7 +71,7 @@ assert_first() { } test_promoting_values() { - PROFILE="promoting-$(uuidgen)" + PROFILE="promoting-$(uuid)" pick_x h pick_x z # just to get the new STDIN @@ -83,7 +83,7 @@ test_promoting_values() { } test_higher_values_loose_tie() { - PROFILE="higher-loose-tie-$(uuidgen)" + PROFILE="higher-loose-tie-$(uuid)" pick_x f pick_x f @@ -94,7 +94,7 @@ test_higher_values_loose_tie() { } test_smaller_values_win_tie() { - PROFILE="smaller-win-tie-$(uuidgen)" + PROFILE="smaller-win-tie-$(uuid)" pick_x d pick_x d @@ -105,7 +105,7 @@ test_smaller_values_win_tie() { } test_many_sequential_picks() { - PROFILE="many-sequential-picks-$(uuidgen)" + PROFILE="many-sequential-picks-$(uuid)" pick_x b pick_x r |