Skip to content

Commit 8c2775f

Browse files
committed
Fix tests that were failing on alpine
Ensure perl exists for git blame tests, replace timing sensitive `ui_out -ignore ...` with `ui_out -until '...'`
1 parent b4a485a commit 8c2775f

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
ui_out -ignore 7
1+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
22
exec 5>fifo
3-
ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
43

54
echo '* line1' >&5
65
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "*" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " line1\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
7-
ui_out -ignore 2
6+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
87

98
echo '* line2' >&5
109
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "*" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " line1\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "* line2\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
11-
ui_out -ignore 2
10+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
1211

1312
dd if=/dev/zero bs=2049 count=1 2>/dev/null | sed s/././g >&5
14-
ui_out -ignore 3
13+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
1514
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "gjxH|wc -c | tr -d \" \"<ret>" ] }'
16-
ui_out -ignore 6
15+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
1716

1817
exec 5>&-
19-
ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*fifo* 3:4 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'
18+
ui_out -until '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*fifo* 3:4 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'

test/run

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ ui_out() {
190190
skip_count=$(( skip_count - 1 ))
191191
done
192192
;;
193+
-until)
194+
shift
195+
while read -r event <&4; do
196+
[ "$event" == "$1" ] && break
197+
done
198+
;;
193199
-until-grep)
194200
shift
195201
while
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
command -v git >/dev/null
2+
command -v git >/dev/null && command -v perl >/dev/null
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
ui_out -ignore 7
2-
ui_out -ignore 11
1+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
32

43
# We've jumped to the new version of line 2. Move to the old version so we
54
# can annotate the old file.
65
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "k:git blame<ret>" ] }'
7-
ui_out -ignore 11
6+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
87

98
# We should have jumped to the old version of line 2, assert on kak_selection.
109
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "x" ] }'
11-
ui_out -ignore 5
10+
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
command -v git >/dev/null
2+
command -v git >/dev/null && command -v perl >/dev/null
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
while ! ui_out -until-grep draw_status | grep -v '\[fifo\]' >/dev/null;
2-
do
3-
:
1+
while true; do
2+
ui_out -until-grep draw_status | grep -v '\[fifo\]' >/dev/null && break
43
done
54
actual_draw_status=$(ui_out -until-grep draw_status)
65

@@ -11,5 +10,5 @@ EOF
1110
expected_subject_json=\"$(printf '%s' "$expected_subject" | sed 's/"/\\"/g')\"
1211
expected_draw_status='{ "jsonrpc": "2.0", "method": "draw_status", "params": [[{ "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": '"$expected_subject_json"' }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*git* 13:2 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'
1312

14-
assert_eq "$actual_draw_status" "$expected_draw_status"
13+
assert_eq "$expected_draw_status" "$actual_draw_status"
1514
ui_out -ignore 2

0 commit comments

Comments
 (0)