From 65fb622000af8e3dbb65480e1581758ecf4ba3e2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 00:12:26 +0300 Subject: functests: Replace execute with either command or feed_command Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed. --- test/functional/terminal/buffer_spec.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'test/functional/terminal/buffer_spec.lua') diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 129390a7a5..48b8512bf0 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim local wait = helpers.wait -local eval, execute, source = helpers.eval, helpers.execute, helpers.source +local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source local eq, neq = helpers.eq, helpers.neq local write_file = helpers.write_file @@ -13,7 +13,7 @@ describe('terminal buffer', function() before_each(function() clear() - execute('set modifiable swapfile undolevels=20') + feed_command('set modifiable swapfile undolevels=20') wait() screen = thelpers.screen_setup() end) @@ -86,7 +86,7 @@ describe('terminal buffer', function() it('sends data to the terminal when the "put" operator is used', function() feed('gg"ayj') - execute('let @a = "appended " . @a') + feed_command('let @a = "appended " . @a') feed('"ap"ap') screen:expect([[ ^tty ready | @@ -112,8 +112,8 @@ describe('terminal buffer', function() it('sends data to the terminal when the ":put" command is used', function() feed('gg"ayj') - execute('let @a = "appended " . @a') - execute('put a') + feed_command('let @a = "appended " . @a') + feed_command('put a') screen:expect([[ ^tty ready | appended tty ready | @@ -124,7 +124,7 @@ describe('terminal buffer', function() :put a | ]]) -- line argument is only used to move the cursor - execute('6put a') + feed_command('6put a') screen:expect([[ tty ready | appended tty ready | @@ -147,7 +147,7 @@ describe('terminal buffer', function() {4:~ }| :bd! | ]]) - execute('bnext') + feed_command('bnext') screen:expect([[ ^ | {4:~ }| @@ -162,7 +162,7 @@ describe('terminal buffer', function() it('handles loss of focus gracefully', function() -- Change the statusline to avoid printing the file name, which varies. nvim('set_option', 'statusline', '==========') - execute('set laststatus=0') + feed_command('set laststatus=0') -- Save the buffer number of the terminal for later testing. local tbuf = eval('bufnr("%")') @@ -191,16 +191,16 @@ describe('terminal buffer', function() ]]) neq(tbuf, eval('bufnr("%")')) - execute('quit!') -- Should exit the new window, not the terminal. + feed_command('quit!') -- Should exit the new window, not the terminal. eq(tbuf, eval('bufnr("%")')) - execute('set laststatus=1') -- Restore laststatus to the default. + feed_command('set laststatus=1') -- Restore laststatus to the default. end) it('term_close() use-after-free #4393', function() - execute('terminal yes') + feed_command('terminal yes') feed([[]]) - execute('bdelete!') + feed_command('bdelete!') end) end) @@ -217,12 +217,12 @@ describe('No heap-buffer-overflow when using', function() end) it('termopen(echo) #3161', function() - execute('edit ' .. testfilename) + feed_command('edit ' .. testfilename) -- Move cursor away from the beginning of the line feed('$') -- Let termopen() modify the buffer - execute('call termopen("echo")') + feed_command('call termopen("echo")') wait() - execute('bdelete!') + feed_command('bdelete!') end) end) -- cgit From 4b1f21de75f9981007d80aca8355239e8615d6bd Mon Sep 17 00:00:00 2001 From: erw7 Date: Tue, 28 Mar 2017 18:07:58 +0900 Subject: win: support :terminal --- test/functional/terminal/buffer_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/terminal/buffer_spec.lua') diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 48b8512bf0..22ab0a8c21 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -6,8 +6,6 @@ local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.s local eq, neq = helpers.eq, helpers.neq local write_file = helpers.write_file -if helpers.pending_win32(pending) then return end - describe('terminal buffer', function() local screen @@ -72,6 +70,7 @@ describe('terminal buffer', function() end) it('cannot be modified directly', function() + if helpers.pending_win32(pending) then return end feed('dd') screen:expect([[ tty ready | @@ -160,6 +159,7 @@ describe('terminal buffer', function() end) it('handles loss of focus gracefully', function() + if helpers.pending_win32(pending) then return end -- Change the statusline to avoid printing the file name, which varies. nvim('set_option', 'statusline', '==========') feed_command('set laststatus=0') @@ -205,7 +205,7 @@ describe('terminal buffer', function() end) describe('No heap-buffer-overflow when using', function() - + if helpers.pending_win32(pending) then return end local testfilename = 'Xtestfile-functional-terminal-buffers_spec' before_each(function() -- cgit From d2d76882f74875d6c1ee10f31524b104eab6375d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 8 Aug 2017 02:26:25 +0200 Subject: win/test: enable more :terminal tests To deal with SIGWINCH limitations on Windows, change some resize tests to _shrink_ the screen width. ... But this didn't work, so still ignoring those tests on Windows. --- test/functional/terminal/buffer_spec.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/functional/terminal/buffer_spec.lua') diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 22ab0a8c21..4ce33fef7b 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -70,7 +70,6 @@ describe('terminal buffer', function() end) it('cannot be modified directly', function() - if helpers.pending_win32(pending) then return end feed('dd') screen:expect([[ tty ready | @@ -205,7 +204,6 @@ describe('terminal buffer', function() end) describe('No heap-buffer-overflow when using', function() - if helpers.pending_win32(pending) then return end local testfilename = 'Xtestfile-functional-terminal-buffers_spec' before_each(function() -- cgit