mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-22 05:03:56 +03:00
Remove noisy output from tests
"ui_out -until-grep" invocations used to redirect the output from
grep, usually to /dev/null. Looks like the intention of 60fcc3443
(Change ui_out -until-grep to check for equality the next argument,
2024-11-02) was that grep no longer needs to print output, since we
can assert instead which is mildly better.
Unfortunately there are two places where -until-grep might not be
powerful enough, which is why we capture the output and check it
in the test script. For one of them we can use -until-grep with a
small change. Not yet sure about the other one. Let's try to use
eval instead, so we can silence the output.
I realize -until-eval is not great (the nested quoting is ugly)
but I guess it's better than the status quo.
Alternatively, we could print output only if the [expected] argument
is not given, and add >/dev/null to the other invocations.
This commit is contained in:
parent
66aa444c6f
commit
8c74660ad3
4
test/run
4
test/run
@ -198,11 +198,11 @@ ui_out() {
|
||||
[ "$event" = "$expected" ] && break
|
||||
done
|
||||
;;
|
||||
-until-grep)
|
||||
-until-eval | -until-grep)
|
||||
pattern=$1
|
||||
shift
|
||||
while read -r event <&4; do
|
||||
if printf %s "$event" | grep "$pattern"; then
|
||||
if printf %s "$event" | "${arg#-until-}" "$pattern" >/dev/null; then
|
||||
if [ $# -ne 0 ]; then
|
||||
assert_eq "$1" "$event"
|
||||
shift
|
||||
|
@ -3,7 +3,7 @@ ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
# We've jumped to the new version of line 2. Move to the old version so we
|
||||
# can annotate the old file.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "k:git blame<ret>" ] }'
|
||||
while ui_out -until-grep '"draw_status"' | grep '\[fifo\]'; do :; done > /dev/null
|
||||
ui_out -until-eval 'grep "draw_status" | grep -v "\[fifo\]"'
|
||||
|
||||
# We should have jumped to the old version of line 2, assert on kak_selection.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "x" ] }'
|
||||
|
@ -1,8 +1,3 @@
|
||||
while true; do
|
||||
ui_out -until-grep draw_status | grep -v '\[fifo\]' >/dev/null && break
|
||||
done
|
||||
actual_draw_status=$(ui_out -until-grep draw_status)
|
||||
|
||||
expected_subject=$(cat <<'EOF'
|
||||
2017-07-14 A U Thor "Don't break on single quotes or unbalanced {"
|
||||
EOF
|
||||
@ -10,5 +5,5 @@ EOF
|
||||
expected_subject_json=\"$(printf '%s' "$expected_subject" | sed 's/"/\\"/g')\"
|
||||
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": [] }] }'
|
||||
|
||||
assert_eq "$expected_draw_status" "$actual_draw_status"
|
||||
ui_out -until-grep 'draw_status.*single quotes' "$expected_draw_status"
|
||||
ui_out -ignore 2
|
||||
|
Loading…
Reference in New Issue
Block a user