diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-08-20 18:51:25 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2018-08-27 15:15:49 +0200 |
commit | 3d88287e3016aacae64e2ddcd11a37e024557e45 (patch) | |
tree | 241711e8f052f02b0e465a42f6d47af302c8743b /test/functional/ui/wildmode_spec.lua | |
parent | 03978a0f296aa8638a578698ea0a6cceedb34527 (diff) | |
download | rneovim-3d88287e3016aacae64e2ddcd11a37e024557e45.tar.gz rneovim-3d88287e3016aacae64e2ddcd11a37e024557e45.tar.bz2 rneovim-3d88287e3016aacae64e2ddcd11a37e024557e45.zip |
tests: introduce screen:expect{...} form
Diffstat (limited to 'test/functional/ui/wildmode_spec.lua')
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index b60d520ca0..72dbef9538 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -167,7 +167,7 @@ describe("'wildmenu'", function() screen:sleep(10) -- Flush -- Check only the last 2 lines, because the shell output is -- system-dependent. - screen:expect('! # & < = > @ > \n:!^', nil, nil, nil, true) + screen:expect{any='! # & < = > @ > \n:!^'} end) end) @@ -204,21 +204,11 @@ end) describe('ui/ext_wildmenu', function() local screen - local items, selected = nil, nil before_each(function() clear() screen = Screen.new(25, 5) screen:attach({rgb=true, ext_wildmenu=true}) - screen:set_on_event_handler(function(name, data) - if name == "wildmenu_show" then - items = data[1] - elseif name == "wildmenu_select" then - selected = data[1] - elseif name == "wildmenu_hide" then - items, selected = nil, nil - end - end) end) after_each(function() @@ -238,63 +228,48 @@ describe('ui/ext_wildmenu', function() command('set wildmode=full') command('set wildmenu') feed(':sign <tab>') - screen:expect([[ + screen:expect{grid=[[ | ~ | ~ | ~ | :sign define^ | - ]], nil, nil, function() - eq(expected, items) - eq(0, selected) - end) + ]], wildmenu_items=expected, wildmenu_pos=0} feed('<tab>') - screen:expect([[ + screen:expect{grid=[[ | ~ | ~ | ~ | :sign jump^ | - ]], nil, nil, function() - eq(expected, items) - eq(1, selected) - end) + ]], wildmenu_items=expected, wildmenu_pos=1} feed('<left><left>') - screen:expect([[ + screen:expect{grid=[[ | ~ | ~ | ~ | :sign ^ | - ]], nil, nil, function() - eq(expected, items) - eq(-1, selected) - end) + ]], wildmenu_items=expected, wildmenu_pos=-1} feed('<right>') - screen:expect([[ + screen:expect{grid=[[ | ~ | ~ | ~ | :sign define^ | - ]], nil, nil, function() - eq(expected, items) - eq(0, selected) - end) + ]], wildmenu_items=expected, wildmenu_pos=0} feed('a') - screen:expect([[ + screen:expect{grid=[[ | ~ | ~ | ~ | :sign definea^ | - ]], nil, nil, function() - eq(nil, items) - eq(nil, selected) - end) + ]]} end) end) |