aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-10-19 15:18:47 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2016-10-19 15:21:49 +0200
commitd1070787ca9570c3a32a9fa664cebaa9d4059109 (patch)
tree69d13e9f2a70c2cfd04a6700d614c1bb7824f2de
parent2d961403baf3ed702982ca946ba41a6602ec8608 (diff)
downloadrneovim-d1070787ca9570c3a32a9fa664cebaa9d4059109.tar.gz
rneovim-d1070787ca9570c3a32a9fa664cebaa9d4059109.tar.bz2
rneovim-d1070787ca9570c3a32a9fa664cebaa9d4059109.zip
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.
-rw-r--r--test/functional/terminal/api_spec.lua12
1 files changed, 11 insertions, 1 deletions
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}))