test: Clear socket correctly when XDG_RUNTIME_DIR is set

This commit is contained in:
Jason Felice 2019-10-03 22:18:52 -04:00
parent 081595fa2f
commit 2b1ca43328

View File

@ -60,7 +60,7 @@ main() {
number_tests=$(($number_tests + 1)) number_tests=$(($number_tests + 1))
touch in; cp in out touch in; cp in out
session="kak-tests" session="kak-tests"
rm -f $tmpdir/kakoune/$USER/$session rm -f "$(session_path $session)"
$root/../src/kak out -n -s "$session" -ui json -e "$kak_commands" > ui-out < "${ui_in}" $root/../src/kak out -n -s "$session" -ui json -e "$kak_commands" > ui-out < "${ui_in}"
retval=$? retval=$?
failed=0 failed=0
@ -117,6 +117,14 @@ main() {
# Utility ├───────────────────────────────────────────────────────────────────── # Utility ├─────────────────────────────────────────────────────────────────────
session_path() {
if [ -n "$XDG_RUNTIME_DIR" ]; then
printf %s "${XDG_RUNTIME_DIR}/kakoune/$1"
else
printf %s "${TMPDIR:-/tmp}/kakoune/${USER}/$1"
fi
}
show_diff() { show_diff() {
diff -u $1 $2 | while IFS='' read -r line; do diff -u $1 $2 | while IFS='' read -r line; do
first_character=$(printf '%s\n' "$line" | cut -b 1) first_character=$(printf '%s\n' "$line" | cut -b 1)