From d1070787ca9570c3a32a9fa664cebaa9d4059109 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Wed, 19 Oct 2016 15:18:47 +0200 Subject: tests: fix racyness in terminal/api_spec.lua Previously, the nvim_input from the socket channels could be processed before the input from stdin in rare cases. --- test/functional/terminal/api_spec.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua index 58d6c75940..045bdb0749 100644 --- a/test/functional/terminal/api_spec.lua +++ b/test/functional/terminal/api_spec.lua @@ -22,7 +22,7 @@ describe('api', function() -- Start the socket from the child nvim. child_session.feed_data(":echo serverstart('"..socket_name.."')\n") - -- Wait for socket creation by abusing expect(). + -- Wait for socket creation. screen:expect([[ {1: } | {4:~ }| @@ -37,6 +37,16 @@ describe('api', function() local socket_session2 = helpers.connect(socket_name) child_session.feed_data("i[tui] insert-mode") + -- Wait for stdin to be processed. + screen:expect([[ + [tui] insert-mode{1: } | + {4:~ }| + {4:~ }| + {4:~ }| + {5:[No Name] [+] }| + {3:-- INSERT --} | + {3:-- TERMINAL --} | + ]]) ok(socket_session1:request("nvim_ui_attach", 42, 6, {rgb=true})) ok(socket_session2:request("nvim_ui_attach", 25, 30, {rgb=true})) -- cgit