aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ranking.sh28
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