summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-11-02 10:13:02 +1100
committerMaxime Coste <mawww@kakoune.org>2024-11-04 07:15:34 +1100
commit60fcc3443ef199f329a4e5c4fcd94ad017813a9b (patch)
tree1dafdd427d729f835ad54d30d6a44c893ed5cb62
parentbe82047dbf5f74f123e925b96e0e13962a4e0c09 (diff)
Change ui_out -until-grep to check for equality the next argument
Instead of outputing the matching output, either ignore the output (if not extra argument is given) or match it. Usage is: ui_out -until-grep <pattern> [<expected>]
-rw-r--r--test/regression/0-eval-creates-prompt/script2
-rw-r--r--test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script8
-rwxr-xr-xtest/run13
3 files changed, 13 insertions, 10 deletions
diff --git a/test/regression/0-eval-creates-prompt/script b/test/regression/0-eval-creates-prompt/script
index c9455f5e..d2028b9c 100644
--- a/test/regression/0-eval-creates-prompt/script
+++ b/test/regression/0-eval-creates-prompt/script
@@ -2,4 +2,4 @@ ui_out -ignore 7
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ ":eval %{ exec %{:echo -} }<ret>" ] }'
ui_out -ignore 5
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "markup 123<ret>" ] }'
-ui_out -until-grep '"method": "draw_status", .* "contents": "123"' >/dev/null
+ui_out -until-grep '"method": "draw_status", .* "contents": "123"'
diff --git a/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script
index 905bb6f7..2356f6e4 100644
--- a/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script
+++ b/test/regression/5118-crash-on-scroll-with-insert-completion-and-wrap/script
@@ -1,8 +1,8 @@
ui_out -ignore 6
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "a<space>2<c-x><c-w>" ] }'
-ui_out -until-grep menu_show >/dev/null
-ui_out -until-grep refresh >/dev/null
-ui_out -until-grep menu_show >/dev/null
-ui_out -until-grep refresh >/dev/null
+ui_out -until-grep menu_show
+ui_out -until-grep refresh
+ui_out -until-grep menu_show
+ui_out -until-grep refresh
ui_in '{ "jsonrpc": "2.0", "method": "scroll", "params": [ -5, 0, 0 ] }'
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "2\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "3\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "4\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "5\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "6\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "7\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "8\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "9\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "10\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "11\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "12\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "13\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "14\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "15\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "16\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "17\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "18\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "19\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "20\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "21\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "22\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "23\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "24\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
diff --git a/test/run b/test/run
index a65f5396..5c3df4fb 100755
--- a/test/run
+++ b/test/run
@@ -197,11 +197,14 @@ ui_out() {
done
;;
-until-grep)
- shift
- while
- read -r event <&4
- ! printf %s "$event" | grep "$@"
- do :; done
+ pattern=$2
+ shift 2
+ while read -r event <&4; do
+ if printf %s "$event" | grep "$pattern"; then
+ [ $# -ne 0 ] && assert_eq "$1" "$event"
+ break
+ fi
+ done
;;
*)
read -r event <&4