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/mode_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/mode_spec.lua')
-rw-r--r-- | test/functional/ui/mode_spec.lua | 116 |
1 files changed, 39 insertions, 77 deletions
diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua index f0cedfeeb5..f6b3c1c3c9 100644 --- a/test/functional/ui/mode_spec.lua +++ b/test/functional/ui/mode_spec.lua @@ -21,207 +21,169 @@ describe('ui mode_change event', function() end) it('works in normal mode', function() - screen:expect([[ + screen:expect{grid=[[ ^ | {0:~ }| {0:~ }| | - ]],nil,nil,function () - eq("normal", screen.mode) - end) + ]], mode="normal"} feed('d') - screen:expect([[ + screen:expect{grid=[[ ^ | {0:~ }| {0:~ }| | - ]],nil,nil,function () - eq("operator", screen.mode) - end) + ]], mode="operator"} feed('<esc>') - screen:expect([[ + screen:expect{grid=[[ ^ | {0:~ }| {0:~ }| | - ]],nil,nil,function () - eq("normal", screen.mode) - end) + ]], mode="normal"} end) it('works in insert mode', function() feed('i') - screen:expect([[ + screen:expect{grid=[[ ^ | {0:~ }| {0:~ }| {2:-- INSERT --} | - ]],nil,nil,function () - eq("insert", screen.mode) - end) + ]], mode="insert"} feed('word<esc>') - screen:expect([[ + screen:expect{grid=[[ wor^d | {0:~ }| {0:~ }| | - ]], nil, nil, function () - eq("normal", screen.mode) - end) + ]], mode="normal"} command("set showmatch") eq(eval('&matchtime'), 5) -- tenths of seconds feed('a(stuff') - screen:expect([[ + screen:expect{grid=[[ word(stuff^ | {0:~ }| {0:~ }| {2:-- INSERT --} | - ]], nil, nil, function () - eq("insert", screen.mode) - end) + ]], mode="insert"} feed(')') - screen:expect([[ + screen:expect{grid=[[ word^(stuff) | {0:~ }| {0:~ }| {2:-- INSERT --} | - ]], nil, nil, function () - eq("showmatch", screen.mode) - end) + ]], mode="showmatch"} screen:sleep(400) - screen:expect([[ + screen:expect{grid=[[ word(stuff)^ | {0:~ }| {0:~ }| {2:-- INSERT --} | - ]], nil, nil, function () - eq("insert", screen.mode) - end) + ]], mode="insert"} end) it('works in replace mode', function() feed('R') - screen:expect([[ + screen:expect{grid=[[ ^ | {0:~ }| {0:~ }| {2:-- REPLACE --} | - ]], nil, nil, function () - eq("replace", screen.mode) - end) + ]], mode="replace"} feed('word<esc>') - screen:expect([[ + screen:expect{grid=[[ wor^d | {0:~ }| {0:~ }| | - ]], nil, nil, function () - eq("normal", screen.mode) - end) + ]], mode="normal"} end) it('works in cmdline mode', function() feed(':') - screen:expect([[ + screen:expect{grid=[[ | {0:~ }| {0:~ }| :^ | - ]],nil,nil,function () - eq("cmdline_normal", screen.mode) - end) + ]], mode="cmdline_normal"} feed('x<left>') - screen:expect([[ + screen:expect{grid=[[ | {0:~ }| {0:~ }| :^x | - ]],nil,nil,function () - eq("cmdline_insert", screen.mode) - end) + ]], mode="cmdline_insert"} feed('<insert>') - screen:expect([[ + screen:expect{grid=[[ | {0:~ }| {0:~ }| :^x | - ]],nil,nil,function () - eq("cmdline_replace", screen.mode) - end) + ]], mode="cmdline_replace"} feed('<right>') - screen:expect([[ + screen:expect{grid=[[ | {0:~ }| {0:~ }| :x^ | - ]],nil,nil,function () - eq("cmdline_normal", screen.mode) - end) + ]], mode="cmdline_normal"} feed('<esc>') - screen:expect([[ + screen:expect{grid=[[ ^ | {0:~ }| {0:~ }| | - ]],nil,nil,function () - eq("normal", screen.mode) - end) + ]], mode="normal"} end) - it('works in visal mode', function() + it('works in visual mode', function() insert("text") feed('v') - screen:expect([[ + screen:expect{grid=[[ tex^t | {0:~ }| {0:~ }| {2:-- VISUAL --} | - ]],nil,nil,function () - eq("visual", screen.mode) - end) + ]], mode="visual"} feed('<esc>') - screen:expect([[ + screen:expect{grid=[[ tex^t | {0:~ }| {0:~ }| | - ]],nil,nil,function () - eq("normal", screen.mode) - end) + ]], mode="normal"} command('set selection=exclusive') feed('v') - screen:expect([[ + screen:expect{grid=[[ tex^t | {0:~ }| {0:~ }| {2:-- VISUAL --} | - ]],nil,nil,function () - eq("visual_select", screen.mode) - end) + ]], mode="visual_select"} feed('<esc>') - screen:expect([[ + screen:expect{grid=[[ tex^t | {0:~ }| {0:~ }| | - ]],nil,nil,function () - eq("normal", screen.mode) - end) + ]], mode="normal"} end) end) |