commit 1a145d298f86689542f58414c69159ebda3c87b2
parent 4e969bd67dc008fe82b309a3d8a4f924bf274421
Author: Chris Down <chris@chrisdown.name>
Date: Tue, 20 Feb 2018 11:30:07 +0000
Fix tests to use version 5 format
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/tests/test-clipmenu b/tests/test-clipmenu
@@ -6,9 +6,9 @@ set -o pipefail
: "${CM_DIR="${XDG_RUNTIME_DIR-"${TMPDIR-/tmp}"}"}"
-major_version=4
+major_version=5
dir=$CM_DIR/clipmenu.$major_version.$USER
-cache_file=$dir/line_cache
+cache_file=$dir/line_cache_primary
if [[ $0 == /* ]]; then
location=${0%/*}
@@ -58,8 +58,8 @@ rm -rf "$dir"
mkdir -p "$dir"
cat > "$cache_file" << 'EOF'
-Selected text. (2 lines)
-Selected text 2. (2 lines)
+1234 Selected text. (2 lines)
+1235 Selected text 2. (2 lines)
EOF
cat > "$dir/$(cksum <<< 'Selected text. (2 lines)')" << 'EOF'
@@ -70,7 +70,6 @@ EOF
### TESTS ###
temp=$(mktemp)
-trap 'rm -f -- "$temp"' EXIT
/tmp/clipmenu --foo bar > "$temp" 2>&1
diff --git a/tests/test-perf b/tests/test-perf
@@ -1,6 +1,6 @@
#!/bin/bash
-major_version=4
+major_version=5
msg() {
printf '>>> %s\n' "$@" >&2
@@ -9,7 +9,7 @@ msg() {
: "${CM_DIR="${XDG_RUNTIME_DIR-"${TMPDIR-/tmp}"}"}"
dir=$CM_DIR/clipmenu.$major_version.$USER
-cache_file=$dir/line_cache
+cache_file=$dir/line_cache_primary
log=$(mktemp)
tim=$(mktemp)
@@ -62,7 +62,7 @@ if ! (( NO_RECREATE )); then
)
read -r first_line_raw <<< "$data"
printf -v first_line '%s (%s lines)\n' "$first_line_raw" "$num_lines"
- printf '%s' "$first_line" >> "$cache_file"
+ printf '%d %s' "$i" "$first_line" >> "$cache_file"
fn=$dir/$(cksum <<< "$first_line")
printf '%s' "$data" > "$fn"
done