diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-09-23 12:31:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-23 12:31:05 +0200 |
commit | 3c53371b0ccbfa03260b5d58eef3994a656fc1a5 (patch) | |
tree | 560d4ad0ad3eee4490c2c937676f71f8df6e694b /test/functional/terminal/api_spec.lua | |
parent | 7307096c5ef5f54e49f2f49fb049fe40f8417f7e (diff) | |
parent | b94891421af5b3e7ba9629baaa9b181e27b3ca2f (diff) | |
download | rneovim-3c53371b0ccbfa03260b5d58eef3994a656fc1a5.tar.gz rneovim-3c53371b0ccbfa03260b5d58eef3994a656fc1a5.tar.bz2 rneovim-3c53371b0ccbfa03260b5d58eef3994a656fc1a5.zip |
Merge #4972 from justinmk/schedule-ui_refresh
Schedule ui_refresh
Diffstat (limited to 'test/functional/terminal/api_spec.lua')
-rw-r--r-- | test/functional/terminal/api_spec.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/functional/terminal/api_spec.lua b/test/functional/terminal/api_spec.lua new file mode 100644 index 0000000000..58d6c75940 --- /dev/null +++ b/test/functional/terminal/api_spec.lua @@ -0,0 +1,60 @@ +local helpers = require('test.functional.helpers')(after_each) +local child_session = require('test.functional.terminal.helpers') +local ok = helpers.ok + +if helpers.pending_win32(pending) then return end + +describe('api', function() + local screen + local socket_name = "Xtest_functional_api.sock" + + before_each(function() + helpers.clear() + os.remove(socket_name) + screen = child_session.screen_setup(0, '["'..helpers.nvim_prog + ..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]') + end) + after_each(function() + os.remove(socket_name) + end) + + it("qa! RPC request during insert-mode", function() + -- Start the socket from the child nvim. + child_session.feed_data(":echo serverstart('"..socket_name.."')\n") + + -- Wait for socket creation by abusing expect(). + screen:expect([[ + {1: } | + {4:~ }| + {4:~ }| + {4:~ }| + {5:[No Name] }| + ]]..socket_name..[[ | + {3:-- TERMINAL --} | + ]]) + + local socket_session1 = helpers.connect(socket_name) + local socket_session2 = helpers.connect(socket_name) + + child_session.feed_data("i[tui] insert-mode") + + ok(socket_session1:request("nvim_ui_attach", 42, 6, {rgb=true})) + ok(socket_session2:request("nvim_ui_attach", 25, 30, {rgb=true})) + + socket_session1:notify("nvim_input", "\n[socket 1] this is more than 25 columns") + socket_session2:notify("nvim_input", "\n[socket 2] input") + + screen:expect([[ + [tui] insert-mode | + [socket 1] this is more t{4: }| + han 25 columns {4: }| + [socket 2] input{1: } {4: }| + {5:[No Name] [+] }| + {3:-- INSERT --} | + {3:-- TERMINAL --} | + ]]) + + socket_session1:request("nvim_command", "qa!") + end) +end) + |