diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-03-01 18:28:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-01 18:28:45 +0100 |
commit | 2c408c0c94915b6c38c1eccdb68b2645829130c2 (patch) | |
tree | a4712c411404a6125d3428c57d08bf019c7b9c28 /test | |
parent | 4e4c7850635dfa3218f2461b50a0b2b2c84d7242 (diff) | |
parent | 4306e5ae0c2a31ea6798af41f7033771af9af6d5 (diff) | |
download | rneovim-2c408c0c94915b6c38c1eccdb68b2645829130c2.tar.gz rneovim-2c408c0c94915b6c38c1eccdb68b2645829130c2.tar.bz2 rneovim-2c408c0c94915b6c38c1eccdb68b2645829130c2.zip |
Merge #6185 from justinmk/term-cursor
terminal: Keep cursor position; Disable 'cursorline'
Diffstat (limited to 'test')
-rw-r--r-- | test/.luacheckrc | 4 | ||||
-rw-r--r-- | test/functional/autocmd/termclose_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/legacy/007_ball_buffer_list_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/legacy/054_buffer_local_autocommands_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/legacy/074_global_var_in_viminfo_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 8 | ||||
-rw-r--r-- | test/functional/terminal/cursor_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/terminal/mouse_spec.lua | 38 | ||||
-rw-r--r-- | test/functional/terminal/window_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/mouse_spec.lua | 6 | ||||
-rw-r--r-- | test/unit/api/helpers.lua | 3 |
11 files changed, 42 insertions, 51 deletions
diff --git a/test/.luacheckrc b/test/.luacheckrc index 1c98d096a4..034b4f10df 100644 --- a/test/.luacheckrc +++ b/test/.luacheckrc @@ -12,5 +12,9 @@ self = false -- Rerun tests only if their modification time changed. cache = true +ignore = { + "631", -- max_line_length +} + -- Ignore whitespace issues in converted Vim legacy tests. files["functional/legacy"] = {ignore = { "611", "612", "613", "621" }} diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua index 6871711058..227f2cc56d 100644 --- a/test/functional/autocmd/termclose_spec.lua +++ b/test/functional/autocmd/termclose_spec.lua @@ -22,9 +22,9 @@ describe('TermClose event', function() execute('terminal') feed('<c-\\><c-n>') screen:expect([[ - ready $ | + ^ready $ | [Process exited 0] | - ^ | + | TermClose works! | ]]) end) diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua index 07e3fe6e7a..e54525fd06 100644 --- a/test/functional/legacy/007_ball_buffer_list_spec.lua +++ b/test/functional/legacy/007_ball_buffer_list_spec.lua @@ -40,7 +40,7 @@ describe(':ball', function() -- Write contents of this file execute('%yank A') - -- Append contents of second window (Xxx1) + -- Append contents of second window (Xxx1) feed('') execute('%yank A') diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua index 494ea8f927..1f7c4dee6a 100644 --- a/test/functional/legacy/054_buffer_local_autocommands_spec.lua +++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua @@ -13,7 +13,7 @@ describe('BufLeave <buffer>', function() execute('au BufLeave <buffer> update') -- Here, autocommand for xx shall append a line - -- But autocommand shall not apply to buffer named <buffer> + -- But autocommand shall not apply to buffer named <buffer> execute('e somefile') -- Here, autocommand shall be auto-deleted diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua index 2fc30c9d83..e8292db8c1 100644 --- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua +++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua @@ -31,8 +31,8 @@ describe('storing global variables in ShaDa files', function() 'set visualbell', 'set shada+=!', "let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}", - -- Store a really long list. Initially this was testing line wrapping in - -- viminfo, but shada files has no line wrapping, no matter how long the + -- Store a really long list. Initially this was testing line wrapping in + -- viminfo, but shada files has no line wrapping, no matter how long the -- list is. 'let MY_GLOBAL_LIST=range(1,100)' ) diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index cecd67d7fa..a75ec129e4 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -50,11 +50,11 @@ describe('terminal buffer', function() feed('<c-\\><c-n>') screen:expect([[ tty ready | - {2: } | + {2:^ } | + | | | | - ^ | | ]]) end) @@ -74,11 +74,11 @@ describe('terminal buffer', function() feed('<c-\\><c-n>dd') screen:expect([[ tty ready | - {2: } | + {2:^ } | + | | | | - ^ | {8:E21: Cannot make changes, 'modifiable' is off} | ]]) end) diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 1953022a7a..d990f92c3a 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -34,11 +34,11 @@ describe('terminal cursor', function() feed('<c-\\><c-n>') screen:expect([[ tty ready | - {2: } | + {2:^ } | + | | | | - ^ | | ]]) end) @@ -51,11 +51,11 @@ describe('terminal cursor', function() it('is positioned correctly when unfocused', function() screen:expect([[ {7: 1 }tty ready | - {7: 2 }{2: } | + {7: 2 }{2:^ } | {7: 3 } | {7: 4 } | {7: 5 } | - {7: 6 }^ | + {7: 6 } | :set number | ]]) end) @@ -101,21 +101,21 @@ describe('terminal cursor', function() hide_cursor() screen:expect([[ tty ready | + ^ | | | | | - ^ | | ]]) show_cursor() screen:expect([[ tty ready | - {2: } | + {2:^ } | + | | | | - ^ | | ]]) end) @@ -153,11 +153,11 @@ describe('cursor with customized highlighting', function() feed('<c-\\><c-n>') screen:expect([[ tty ready | - {2: } | + {2:^ } | + | | | | - ^ | | ]]) end) diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index da7e1c36db..9239c2ad31 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -1,6 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') -local clear = helpers.clear +local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval local feed, nvim = helpers.feed, helpers.nvim local feed_data = thelpers.feed_data @@ -38,31 +38,17 @@ describe('terminal mouse', function() end) describe('when the terminal has focus', function() - it('will exit focus when scrolled', function() - feed('<MouseDown><0,0>') - screen:expect([[ - line23 | - line24 | - line25 | - line26 | - line27 | - ^line28 | - | - ]]) + it('will exit focus on mouse-scroll', function() + eq('t', eval('mode()')) + feed('<ScrollWheelUp><0,0>') + eq('n', eval('mode()')) end) - it('will exit focus after <C-\\>, then scrolled', function() + it('will exit focus on <C-\\> + mouse-scroll', function() + eq('t', eval('mode()')) feed('<C-\\>') - feed('<MouseDown><0,0>') - screen:expect([[ - line23 | - line24 | - line25 | - line26 | - line27 | - ^line28 | - | - ]]) + feed('<ScrollWheelUp><0,0>') + eq('n', eval('mode()')) end) describe('with mouse events enabled by the program', function() @@ -94,7 +80,7 @@ describe('terminal mouse', function() end) it('will forward mouse scroll to the program', function() - feed('<MouseDown><0,0>') + feed('<ScrollWheelUp><0,0>') screen:expect([[ line27 | line28 | @@ -164,7 +150,7 @@ describe('terminal mouse', function() end) it('wont lose focus if another window is scrolled', function() - feed('<MouseDown><0,0><MouseDown><0,0>') + feed('<ScrollWheelUp><0,0><ScrollWheelUp><0,0>') screen:expect([[ {7: 21 }line |line30 | {7: 22 }line |rows: 5, cols: 25 | @@ -174,7 +160,7 @@ describe('terminal mouse', function() ========== ========== | {3:-- TERMINAL --} | ]]) - feed('<S-MouseUp><0,0>') + feed('<S-ScrollWheelDown><0,0>') screen:expect([[ {7: 26 }line |line30 | {7: 27 }line |rows: 5, cols: 25 | diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index eb7a67a1a6..888b1e1328 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -18,11 +18,11 @@ describe('terminal window', function() feed('<c-\\><c-n>') screen:expect([[ tty ready | - {2: } | + {2:^ } | + | | | | - ^ | | ]]) feed(':set colorcolumn=20<cr>i') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 17d949825a..b2fbedfb5e 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -658,7 +658,7 @@ describe('Mouse input', function() {4:[No Name] [+] }| :vsp | ]]) - feed('<MouseUp><0,0>') + feed('<ScrollWheelDown><0,0>') screen:expect([[ mouse scrolling {4:|}lines | ^ {4:|}to | @@ -675,7 +675,7 @@ describe('Mouse input', function() {4:[No Name] [+] }| | ]]) - feed('<MouseDown><27,0>') + feed('<ScrollWheelUp><27,0>') screen:expect([[ mouse scrolling {4:|}text | ^ {4:|}with | @@ -692,7 +692,7 @@ describe('Mouse input', function() {4:[No Name] [+] }| | ]]) - feed('<MouseDown><27,7><MouseDown>') + feed('<ScrollWheelUp><27,7><ScrollWheelUp>') screen:expect([[ mouse scrolling {4:|}text | ^ {4:|}with | diff --git a/test/unit/api/helpers.lua b/test/unit/api/helpers.lua index 883e1c6c19..166456d2a1 100644 --- a/test/unit/api/helpers.lua +++ b/test/unit/api/helpers.lua @@ -106,7 +106,8 @@ local lua2obj_type_tab = { api.xmalloc(len * ffi.sizeof('KeyValuePair'))), }}) for i = 1, len do - local key, val = table.unpack(kvs[i]) + local table_unpack = table.unpack or unpack -- luacheck: compat + local key, val = table_unpack(kvs[i]) dct.data.dictionary.items[i - 1] = ffi.new( 'KeyValuePair', {key=ffi.gc(lua2obj(key), nil).data.string, value=ffi.gc(lua2obj(val), nil)}) |