Skip to content

Commit 1f63773

Browse files
committed
Make test/run work better from outside the test/ directory
Allow tests to be provided relative to current directory instead of relative to the test directory, to make shell path completion more useful. Properly default to all tests when none are provided.
1 parent fc84aed commit 1f63773

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/run

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ main() {
1919
exec -with-hooks <c-l>
2020
'
2121

22-
cd "$(dirname $0)"
2322
root="$PWD"
23+
testdir="$(dirname $0)"
24+
kak="$(realpath $testdir)/../src/kak"
2425
tmpdir="${TMPDIR:-/tmp}"
2526
work=$(mktemp -d $tmpdir/kak-tests.XXXXXXXX)
2627
session="kak-tests"
@@ -33,7 +34,7 @@ main() {
3334

3435
number_tests=0
3536
number_failures=0
36-
for dir in $(find "${@:-.}" -type d | sed 's|^\./||' | sort); do
37+
for dir in $(find "${@:-$testdir}" -type d | sed 's|^\./||' | sort); do
3738
cd $root/$dir;
3839
if [ ! -f cmd ]; then
3940
echo "$dir"
@@ -56,7 +57,7 @@ main() {
5657
if [ -f env ]; then
5758
. ./env
5859
fi
59-
exec $DEBUGGER $root/../src/kak out -n -s "$session" -ui json -e "$kak_commands" >ui-out <ui-in
60+
exec $DEBUGGER $kak out -n -s "$session" -ui json -e "$kak_commands" >ui-out <ui-in
6061
) &
6162
kakpid=$!
6263

@@ -70,7 +71,7 @@ main() {
7071
ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }'
7172
fi
7273

73-
finished_commands |$root/../src/kak -p "$session" 2>/dev/null
74+
finished_commands |$kak -p "$session" 2>/dev/null
7475
cat <&4 >/dev/null
7576

7677
wait $kakpid

0 commit comments

Comments
 (0)