diff options
author | EuAndreh <eu@euandre.org> | 2021-01-26 20:51:32 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-01-26 21:04:11 -0300 |
commit | 09e22ae773da92ff7b953d95a022168fe15bab62 (patch) | |
tree | fb86123022bdecafca2b0e7e67a28f4cb360cede /tests | |
parent | Remove unused argument from CHANGELOG.sh (diff) | |
download | remembering-09e22ae773da92ff7b953d95a022168fe15bab62.tar.gz (sig) remembering-09e22ae773da92ff7b953d95a022168fe15bab62.tar.xz |
v0.1.1: Allow names with spacesv0.1.1
The test_stdin_is_empty was adapted so it wouldn't exit with status 1.
The previous implementation would effectively do:
printf '' | grep ''
which returns 1, and the test would fail.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/ranking.sh | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/ranking.sh b/tests/ranking.sh index ea9c2c6..c383b59 100755 --- a/tests/ranking.sh +++ b/tests/ranking.sh @@ -224,13 +224,22 @@ test_stdin_is_empty() { testing 'STDIN is empty' PROFILE="stdin-is-empty-$(uuid)" echo "$BASE_PROFILE" > "$XDG_DATA_HOME/$PROFILE" - INPUT='' - pick_x '' "$INPUT" + OUT="$(mktemp)" + ERR="$(mktemp)" + + printf '' | \ + sh remembering \ + -p "$PROFILE" \ + -c 'tee -a /dev/stderr | head -n1' \ + 1>"$OUT" 2>"$ERR" + + STATUS=$? + assert_status 0 + assert_stdout '' assert_profile "$PROFILE" "$BASE_PROFILE" test_ok } - test_profile_does_not_exist() { testing 'profile does not exist' PROFILE="profile-does-not-exist-$(uuid)" @@ -258,6 +267,18 @@ e' test_ok } +test_names_with_spaces() { + testing 'Names with spaces' + PROFILE="names-with-spaces-$(uuid)" + INPUT='a b c +d e f' + EXPECTED='1:a b c +0:d e f' + pick_x 'a b c' "$INPUT" + assert_profile "$PROFILE" "$EXPECTED" + test_ok +} + test_picking_first_makes_it_be_always_first test_promoting_values test_higher_values_loose_tie @@ -269,3 +290,4 @@ test_stdin_is_smaller_than_profile test_stdin_is_empty test_profile_does_not_exist test_profile_is_empty +test_names_with_spaces |