diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-04-04 17:47:23 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-04-06 01:06:39 +0200 |
commit | 3b558e5d7b8c641896a57c5c4e09d9b8f8535fd5 (patch) | |
tree | 47a485a9855043c1c751b770b8f2820e867a4023 /test/functional/ui/screen_basic_spec.lua | |
parent | 4566f7c7cda2c3a181ec58998f7c93dd17500153 (diff) | |
download | rneovim-3b558e5d7b8c641896a57c5c4e09d9b8f8535fd5.tar.gz rneovim-3b558e5d7b8c641896a57c5c4e09d9b8f8535fd5.tar.bz2 rneovim-3b558e5d7b8c641896a57c5c4e09d9b8f8535fd5.zip |
tests: short form `screen:except(func)` expects condition only. #6440
- Use this to properly test cursor shape events.
- tests: update screen_basic_spec to use `screen:expect` short form.
Clearer than using `screen:wait` directy.
Diffstat (limited to 'test/functional/ui/screen_basic_spec.lua')
-rw-r--r-- | test/functional/ui/screen_basic_spec.lua | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua index e511234e5e..21953ba294 100644 --- a/test/functional/ui/screen_basic_spec.lua +++ b/test/functional/ui/screen_basic_spec.lua @@ -73,33 +73,29 @@ describe('Screen', function() describe(':suspend', function() it('is forwarded to the UI', function() local function check() - if not screen.suspended then - return 'Screen was not suspended' - end + eq(true, screen.suspended) end execute('suspend') - screen:wait(check) + screen:expect(check) screen.suspended = false feed('<c-z>') - screen:wait(check) + screen:expect(check) end) end) describe('bell/visual bell', function() it('is forwarded to the UI', function() feed('<left>') - screen:wait(function() - if not screen.bell or screen.visual_bell then - return 'Bell was not sent' - end + screen:expect(function() + eq(true, screen.bell) + eq(false, screen.visual_bell) end) screen.bell = false execute('set visualbell') feed('<left>') - screen:wait(function() - if not screen.visual_bell or screen.bell then - return 'Visual bell was not sent' - end + screen:expect(function() + eq(true, screen.visual_bell) + eq(false, screen.bell) end) end) end) @@ -109,22 +105,16 @@ describe('Screen', function() local expected = 'test-title' execute('set titlestring='..expected) execute('set title') - screen:wait(function() - local actual = screen.title - if actual ~= expected then - return 'Expected title to be "'..expected..'" but was "'..actual..'"' - end + screen:expect(function() + eq(expected, screen.title) end) end) it('has correct default title with unnamed file', function() local expected = '[No Name] - NVIM' execute('set title') - screen:wait(function() - local actual = screen.title - if actual ~= expected then - return 'Expected title to be "'..expected..'" but was "'..actual..'"' - end + screen:expect(function() + eq(expected, screen.title) end) end) @@ -132,11 +122,8 @@ describe('Screen', function() local expected = 'myfile (/mydir) - NVIM' execute('set title') execute('file /mydir/myfile') - screen:wait(function() - local actual = screen.title - if actual ~= expected then - return 'Expected title to be "'..expected..'" but was "'..actual..'"' - end + screen:expect(function() + eq(expected, screen.title) end) end) end) @@ -146,11 +133,8 @@ describe('Screen', function() local expected = 'test-icon' execute('set iconstring='..expected) execute('set icon') - screen:wait(function() - local actual = screen.icon - if actual ~= expected then - return 'Expected title to be "'..expected..'" but was "'..actual..'"' - end + screen:expect(function() + eq(expected, screen.icon) end) end) end) |