From b6f8c46c0ee6e17d0bc9a63a6fe3b45e35107bac Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 24 Jan 2021 17:45:34 -0300 Subject: 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. --- tests/ranking.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests') 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 } -- cgit v1.2.3