aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-26 20:51:32 -0300
committerEuAndreh <eu@euandre.org>2021-01-26 21:04:11 -0300
commit09e22ae773da92ff7b953d95a022168fe15bab62 (patch)
treefb86123022bdecafca2b0e7e67a28f4cb360cede
parentRemove unused argument from CHANGELOG.sh (diff)
downloadremembering-0.1.1.tar.gz (sig)
remembering-0.1.1.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.
-rw-r--r--CHANGELOG.md4
-rw-r--r--Makefile2
-rwxr-xr-xremembering4
-rwxr-xr-xtests/ranking.sh28
4 files changed, 32 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9962073..7a58444 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@
## Security
-->
+# 0.1.1 - 2021-01-26
+## Fixed
+Allow names with spaces.
+
# 0.1.0 - 2021-01-26
## Added
Initial public release.
diff --git a/Makefile b/Makefile
index 2a8dcc2..9828f0a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
.POSIX:
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
-VERSION = v0.1.0
+VERSION = v0.1.1
DATE = 2021-01-26
all:
diff --git a/remembering b/remembering
index 0734dae..40d71ef 100755
--- a/remembering
+++ b/remembering
@@ -73,12 +73,12 @@ FILTERED="$(mktemp)"
SORTED_STDIN="$(mktemp)"
cat | sort -u > "$SORTED_STDIN"
-xargs printf '0:%s\n' < "$SORTED_STDIN" | \
+xargs -I{} printf '0:%s\n' "{}" < "$SORTED_STDIN" | \
sort -t: -k2,2 -m - "$PROFILE" | \
tac | \
sort -t: -k2,2 -u > "$MERGED"
-xargs printf 'filter_marker:%s\n' < "$SORTED_STDIN" | \
+xargs -I{} printf 'filter_marker:%s\n' "{}" < "$SORTED_STDIN" | \
cat - "$PROFILE" | \
sort -t: -k2,2 | \
awk '{
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