Skip to content

Commit

Permalink
test: Reduce flakiness of the forbid-edit tests.
Browse files Browse the repository at this point in the history
Sometimes, the choice that is not matched by the search string takes a
little longer to disappear, and end up in the output that is tested.

This change adds a wait-for-output to wait for the uninteresting option
to disappear before checking the output.
  • Loading branch information
szermatt committed Dec 29, 2024
1 parent f7be92c commit 6d2fc50
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/mistty-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,11 @@
(mistty-run-command
(goto-char (mistty-cursor))
(insert " se"))
(mistty-wait-for-output
:test (lambda ()
(save-excursion
(goto-char (point-min))
(not (search-forward "► echo first" nil 'noerror)))))

(should (equal (concat "$ echo first\n"
"first\n"
Expand Down Expand Up @@ -3235,6 +3240,11 @@
(insert "se"))

(mistty-send-text " fi")
(mistty-wait-for-output
:test (lambda ()
(save-excursion
(goto-char (point-min))
(not (search-forward "► echo second" nil 'noerror)))))

(should (equal (concat "$ echo first\n"
"first\n"
Expand Down Expand Up @@ -3317,6 +3327,11 @@
(delete-region (mistty-test-pos-after "") (point-max)))

(mistty-send-text " se")
(mistty-wait-for-output
:test (lambda ()
(save-excursion
(goto-char (point-min))
(not (search-forward "► echo first" nil 'noerror)))))

(should (equal (concat "$ echo first\n"
"first\n"
Expand Down Expand Up @@ -3344,6 +3359,11 @@
(delete-region (pos-bol) (+ 4 (pos-bol))))

(mistty-send-text " se")
(mistty-wait-for-output
:test (lambda ()
(save-excursion
(goto-char (point-min))
(not (search-forward "► echo first" nil 'noerror)))))

(should (equal (concat "$ echo first\n"
"first\n"
Expand Down

0 comments on commit 6d2fc50

Please sign in to comment.