diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-08-17 20:52:08 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-08-17 20:52:08 +0200 |
commit | 3397b8c51a6d65a24bb2d9860e27fb3d8770dba6 (patch) | |
tree | c96596eabfbec82ae02be4531b841837174ceda9 /test | |
parent | e2ccf47b5e5e5acf19a74d928e367c7726d29ad3 (diff) | |
download | rneovim-3397b8c51a6d65a24bb2d9860e27fb3d8770dba6.tar.gz rneovim-3397b8c51a6d65a24bb2d9860e27fb3d8770dba6.tar.bz2 rneovim-3397b8c51a6d65a24bb2d9860e27fb3d8770dba6.zip |
ui: use Window type in win_pos consistently with win_float_pos
Also check invalid positional arguments to screen:expect()
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/multigrid_spec.lua | 32 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 3 |
2 files changed, 18 insertions, 17 deletions
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index c5a23e4661..f2612223ae 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -76,7 +76,7 @@ describe('ext_multigrid', function() it('positions windows correctly', function() command('vsplit') - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [3:--------------------------]{12:│}[2:--------------------------]| [3:--------------------------]{12:│}[2:--------------------------]| @@ -118,15 +118,15 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ]], nil, nil, function() + ]], condition=function() eq({ - [2] = { win = 1000, startrow = 0, startcol = 27, width = 26, height = 12 }, - [3] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 } + [2] = { win = {id=1000}, startrow = 0, startcol = 27, width = 26, height = 12 }, + [3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 } }, screen.win_position) - end) + end} command('wincmd l') command('split') - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [3:--------------------------]{12:│}[4:--------------------------]| [3:--------------------------]{12:│}[4:--------------------------]| @@ -168,16 +168,16 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ]], nil, nil, function() + ]], condition=function() eq({ - [2] = { win = 1000, startrow = 7, startcol = 27, width = 26, height = 5 }, - [3] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 }, - [4] = { win = 1002, startrow = 0, startcol = 27, width = 26, height = 6 } + [2] = { win = {id=1000}, startrow = 7, startcol = 27, width = 26, height = 5 }, + [3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 }, + [4] = { win = {id=1002}, startrow = 0, startcol = 27, width = 26, height = 6 } }, screen.win_position) - end) + end} command('wincmd h') command('q') - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]| [4:-----------------------------------------------------]| @@ -206,12 +206,12 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ]], nil, nil, function() + ]], condition=function() eq({ - [2] = { win = 1000, startrow = 7, startcol = 0, width = 53, height = 5 }, - [4] = { win = 1002, startrow = 0, startcol = 0, width = 53, height = 6 } + [2] = { win = {id=1000}, startrow = 7, startcol = 0, width = 53, height = 5 }, + [4] = { win = {id=1002}, startrow = 0, startcol = 0, width = 53, height = 6 } }, screen.win_position) - end) + end} end) describe('split', function () diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 81a15cada2..d8ad9c9879 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -316,9 +316,10 @@ local ext_keys = { -- cmdline_block: Expected ext_cmdline block (for function definitions) -- wildmenu_items: Expected items for ext_wildmenu -- wildmenu_pos: Expected position for ext_wildmenu -function Screen:expect(expected, attr_ids, attr_ignore) +function Screen:expect(expected, attr_ids, attr_ignore, ...) local grid, condition = nil, nil local expected_rows = {} + assert(next({...}) == nil, "invalid args to expect()") if type(expected) == "table" then assert(not (attr_ids ~= nil or attr_ignore ~= nil)) local is_key = {grid=true, attr_ids=true, attr_ignore=true, condition=true, |