summaryrefslogtreecommitdiff
path: root/test/tools
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2024-02-18 01:16:53 +0100
committerMaxime Coste <mawww@kakoune.org>2024-02-18 15:45:03 +1100
commitf786fceb7392faf7aa4d053ffda5737e0630d4df (patch)
tree28453d9b7c4c27db106bf736f60e217d37020287 /test/tools
parent5f0729f1550a5874961cb83bef6d9e8c6974c808 (diff)
Fix flaky blame-jump-message test
This test fails occasionally[1] because the order of events and the number of events varies across runs. We should always call draw_status exactly 3 times: [*git*][fifo] [*git*] Commit subject etc. [*git*] Let's check it this way. This seems to work; this time I took the time to run it a couple hundred times and in Cirrus CI. [1] https://builds.sr.ht/~mawww/job/1151239
Diffstat (limited to 'test/tools')
-rw-r--r--test/tools/git/blame-jump-message/script16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/tools/git/blame-jump-message/script b/test/tools/git/blame-jump-message/script
index 33e01b6f..5edea930 100644
--- a/test/tools/git/blame-jump-message/script
+++ b/test/tools/git/blame-jump-message/script
@@ -1,10 +1,14 @@
-ui_out -ignore 7
-ui_out -ignore 4
+for _ in fifo-opened fifo-closed blame-info
+do
+ actual_draw_status=$(ui_out -until-grep draw_status)
+done
-ui_out -ignore 3
-subject=$(cat <<'EOF'
+expected_subject=$(cat <<'EOF'
2017-07-14 A U Thor "Don't break on single quotes or unbalanced {"
EOF
)
-json_quoted_subject=\"$(printf '%s' "$subject" | sed 's/"/\\"/g')\"
-ui_out -within-next 3 '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[{ "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": '"$json_quoted_subject"' }], [{ "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": [] }] }'
+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 "$actual_draw_status" "$expected_draw_status"
+ui_out -ignore 2