aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-24 17:45:34 -0300
committerEuAndreh <eu@euandre.org>2021-01-24 17:49:12 -0300
commitb6f8c46c0ee6e17d0bc9a63a6fe3b45e35107bac (patch)
treeda3b03a57430ef3cd9b20c26a00b5a85b05713e7 /tests
parentremembering: Refator to use head/tail instead of read (diff)
downloadremembering-b6f8c46c0ee6e17d0bc9a63a6fe3b45e35107bac.tar.gz
remembering-b6f8c46c0ee6e17d0bc9a63a6fe3b45e35107bac.tar.xz
remembering: Fix behaviour where STDIN is smaller than profile
Now the profile will be an ever growing list, remembering every possible option ever presented to it. The tests in tests/ranking.sh already expected this behaviour and were broken, but now they work.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ranking.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/ranking.sh b/tests/ranking.sh
index d7df451..370c61b 100755
--- a/tests/ranking.sh
+++ b/tests/ranking.sh
@@ -56,7 +56,7 @@ pick_x() {
echo "${2:-$INPUT}" | \
sh remembering \
-p "$PROFILE" \
- -c "tee -a /dev/stderr | grep '$PICK'" \
+ -c "tee -a /dev/stderr | grep \"$PICK\"" \
1>"$OUT" 2>"$ERR"
STATUS=$?
assert_status 0
@@ -66,8 +66,8 @@ pick_x() {
assert_first() {
FIRST="$(head -n1 "$ERR")"
if [ "$FIRST" != "$1" ]; then
- echo 'Previous choice did not appear at the beginning of the list'
- printf '\nexpected: %s\ngot: %s\n' "$1" "$FIRST"
+ printf '\nERR: Previous choice did not appear at the beginning of the list:\n\nexpected: %s\ngot: %s\n' \
+ "$1" "$FIRST" >&2
exit 1
fi
}
@@ -216,7 +216,6 @@ test_stdin_is_smaller_than_profile() {
echo "$BASE_PROFILE" > "$XDG_DATA_HOME/$PROFILE"
INPUT='a'
pick_x a "$INPUT"
- # echo "err is: $(cat "$ERR")"
assert_profile "$PROFILE" "$BASE_PROFILE_A_PICKED"
test_ok
}