diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/window_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/helpers.lua | 9 | ||||
-rw-r--r-- | test/functional/legacy/051_highlight_spec.lua | 40 | ||||
-rw-r--r-- | test/functional/shell/viml_system_spec.lua | 42 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 6 |
5 files changed, 48 insertions, 51 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index f3ac90de21..456252522d 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -4,6 +4,7 @@ local clear, nvim, buffer, curbuf, curbuf_contents, window, curwin, eq, neq, ok, feed, rawfeed, insert, eval = helpers.clear, helpers.nvim, helpers.buffer, helpers.curbuf, helpers.curbuf_contents, helpers.window, helpers.curwin, helpers.eq, helpers.neq, helpers.ok, helpers.feed, helpers.rawfeed, helpers.insert, helpers.eval +local wait = helpers.wait -- check if str is visible at the beginning of some line local function is_visible(str) @@ -55,6 +56,7 @@ describe('window_* functions', function() insert("epilogue") win = curwin() feed('gg') + wait() -- let nvim process the 'gg' command -- cursor position is at beginning eq({1, 0}, window('get_cursor', win)) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index ea98ff4ce3..fc6bf80d7e 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -229,11 +229,15 @@ local function curbuf(method, ...) return buffer(method, buf, ...) end +local function wait() + session:request('vim_eval', '1') +end + local function curbuf_contents() -- Before inspecting the buffer, execute 'vim_eval' to wait until all -- previously sent keys are processed(vim_eval is a deferred function, and -- only processed after all input) - session:request('vim_eval', '1') + wait() return table.concat(curbuf('get_line_slice', 0, -1, true, true), '\n') end @@ -284,5 +288,6 @@ return { curbuf = curbuf, curwin = curwin, curtab = curtab, - curbuf_contents = curbuf_contents + curbuf_contents = curbuf_contents, + wait = wait } diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/051_highlight_spec.lua index f35b70f93f..19eb4104cd 100644 --- a/test/functional/legacy/051_highlight_spec.lua +++ b/test/functional/legacy/051_highlight_spec.lua @@ -1,23 +1,44 @@ -- vim: set foldmethod=marker foldmarker=[[,]] : -- Tests for ":highlight". +local Screen = require('test.functional.ui.screen') local helpers = require('test.functional.helpers') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local execute, expect = helpers.execute, helpers.expect +local wait = helpers.wait describe(':highlight', function() setup(clear) it('is working', function() + local screen = Screen.new(35, 10) + screen:attach() -- Basic test if ":highlight" doesn't crash execute('highlight') + -- FIXME(tarruda): We need to be sure the prompt is displayed before + -- continuing, or risk a race condition where some of the following input + -- is discarded resulting in test failure + screen:expect([[ + :highlight | + SpecialKey xxx ctermfg=4 | + guifg=Blue | + EndOfBuffer xxx links to NonText| + | + NonText xxx ctermfg=12 | + gui=bold | + guifg=Blue | + Directory xxx ctermfg=4 | + -- More --^ | + ]]) + feed('q') + wait() -- wait until we're back to normal execute('hi Search') -- Test setting colors. -- Test clearing one color and all doesn't generate error or warning - execute('hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan') - execute('hi Group2 term= cterm=') - execute('hi Group3 term=underline cterm=bold') + execute('hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan') + execute('hi Group2 cterm=NONE') + execute('hi Group3 cterm=bold') execute('redir! @a') execute('hi NewGroup') execute('hi Group2') @@ -29,7 +50,7 @@ describe(':highlight', function() execute('hi Group2') execute('hi clear') execute('hi Group3') - execute([[hi Crash term='asdf]]) + execute([[hi Crash cterm='asdf]]) execute('redir END') -- Filter ctermfg and ctermbg, the numbers depend on the terminal @@ -48,11 +69,15 @@ describe(':highlight', function() expect([[ - NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3 + NewGroup xxx cterm=italic + ctermfg=2 + ctermbg=3 + guifg=#00ff00 + guibg=Cyan Group2 xxx cleared - Group3 xxx term=underline cterm=bold + Group3 xxx cterm=bold NewGroup xxx cleared @@ -65,6 +90,7 @@ describe(':highlight', function() Group3 xxx cleared - E475: term='asdf]]) + E475: cterm='asdf]]) + screen:detach() end) end) diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index b35f070159..85c055d3be 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -77,27 +77,7 @@ describe('system()', function() ]]) end) - it('`yes` and is directly interrupted with CTRL-C', function() - feed(':call system("yes")<cr><c-c>') - screen:expect([[ - ^ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - Type :quit<Enter> to exit Vim | - ]]) - end) - - it('`yes` and is a little bit later interrupted with CTRL-C', function() + it('`yes` and is interrupted with CTRL-C', function() feed(':call system("yes")<cr>') feed('<c-c>') screen:expect([[ @@ -247,26 +227,6 @@ describe('systemlist()', function() ]]) end) - it('`yes` and is directly interrupted with CTRL-C', function() - feed(':call systemlist("yes | xargs")<cr><c-c>') - screen:expect([[ - ^ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - ~ | - Type :quit<Enter> to exit Vim | - ]]) - end) - it('`yes` and is a little bit later interrupted with CTRL-C', function() feed(':call systemlist("yes | xargs")<cr>') feed('<c-c>') diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index cd8c2bc399..a20907791b 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -116,7 +116,11 @@ local debug_screen local default_screen_timeout = 2500 if os.getenv('VALGRIND') then - default_screen_timeout = 7500 + default_screen_timeout = default_screen_timeout * 3 +end + +if os.getenv('CI_TARGET') then + default_screen_timeout = default_screen_timeout * 3 end local colors = request('vim_get_color_map') |