diff options
-rw-r--r-- | src/nvim/testdir/runtest.vim | 5 | ||||
-rw-r--r-- | src/nvim/testdir/screendump.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/shared.vim | 15 | ||||
-rw-r--r-- | src/nvim/testdir/term_util.vim | 11 | ||||
-rw-r--r-- | src/nvim/testdir/test_bufline.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_debugger.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_fold.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_highlight.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_mksession.vim | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_startup_utf8.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_suspend.vim | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_tabpage.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_timers.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/view_util.vim | 13 |
15 files changed, 42 insertions, 24 deletions
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index fd49e48c2d..adf7463936 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -98,11 +98,6 @@ func GetAllocId(name) return lnum - top - 1 endfunc -func CanRunVimInTerminal() - " Nvim: always false, we use Lua screen-tests instead. - return 0 -endfunc - func RunTheTest(test) echo 'Executing ' . a:test diff --git a/src/nvim/testdir/screendump.vim b/src/nvim/testdir/screendump.vim index e69de29bb2..8afff1da91 100644 --- a/src/nvim/testdir/screendump.vim +++ b/src/nvim/testdir/screendump.vim @@ -0,0 +1,2 @@ +source shared.vim +source term_util.vim diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index 3875ffc056..b041fdedb1 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -1,10 +1,12 @@ " Functions shared by several tests. " Only load this script once. -if exists('*WaitFor') +if exists('*PythonProg') finish endif +source view_util.vim + " {Nvim} " Filepath captured from output may be truncated, like this: " /home/va...estdir/Xtest-tmpdir/nvimxbXN4i/10 @@ -328,17 +330,6 @@ func RunVimPiped(before, after, arguments, pipecmd) return 1 endfunc -" Get line "lnum" as displayed on the screen. -" Trailing white space is trimmed. -func! Screenline(lnum) - let chars = [] - for c in range(1, winwidth(0)) - call add(chars, nr2char(screenchar(a:lnum, c))) - endfor - let line = join(chars, '') - return matchstr(line, '^.\{-}\ze\s*$') -endfunc - func CanRunGui() return has('gui') && ($DISPLAY != "" || has('gui_running')) endfunc diff --git a/src/nvim/testdir/term_util.vim b/src/nvim/testdir/term_util.vim new file mode 100644 index 0000000000..3a838a3a1f --- /dev/null +++ b/src/nvim/testdir/term_util.vim @@ -0,0 +1,11 @@ +" Functions about terminal shared by several tests + +" Only load this script once. +if exists('*CanRunVimInTerminal') + finish +endif + +func CanRunVimInTerminal() + " Nvim: always false, we use Lua screen-tests instead. + return 0 +endfunc diff --git a/src/nvim/testdir/test_bufline.vim b/src/nvim/testdir/test_bufline.vim index a924ce0002..076f03fdd8 100644 --- a/src/nvim/testdir/test_bufline.vim +++ b/src/nvim/testdir/test_bufline.vim @@ -1,7 +1,7 @@ " Tests for setbufline(), getbufline(), appendbufline(), deletebufline() source shared.vim -" source screendump.vim +source screendump.vim func Test_setbufline_getbufline() new diff --git a/src/nvim/testdir/test_debugger.vim b/src/nvim/testdir/test_debugger.vim index 130bcf8910..811717208e 100644 --- a/src/nvim/testdir/test_debugger.vim +++ b/src/nvim/testdir/test_debugger.vim @@ -1,7 +1,7 @@ " Tests for the Vim script debug commands source shared.vim -" source screendump.vim +source screendump.vim " Run a Vim debugger command " If the expected output argument is supplied, then check for it. diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index fed642e34b..42e18ed027 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1,4 +1,6 @@ " Tests for diff mode +source shared.vim +source screendump.vim func Test_diff_fold_sync() enew! diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index 56ed543d4b..692f6e4780 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -1,6 +1,7 @@ " Test for folding source view_util.vim +source screendump.vim func PrepIndent(arg) return [a:arg] + repeat(["\t".a:arg], 5) diff --git a/src/nvim/testdir/test_highlight.vim b/src/nvim/testdir/test_highlight.vim index a320e8edc8..6aa187b17e 100644 --- a/src/nvim/testdir/test_highlight.vim +++ b/src/nvim/testdir/test_highlight.vim @@ -1,6 +1,7 @@ " Tests for ":highlight" and highlighting. source view_util.vim +source screendump.vim func Test_highlight() " basic test if ":highlight" doesn't crash diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 0a8d52242a..9c9e04be07 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -6,6 +6,9 @@ if !has('mksession') finish endif +source shared.vim +source term_util.vim + func Test_mksession() tabnew let wrap_save = &wrap diff --git a/src/nvim/testdir/test_startup_utf8.vim b/src/nvim/testdir/test_startup_utf8.vim index b24b0eb5cf..1b3d2184a0 100644 --- a/src/nvim/testdir/test_startup_utf8.vim +++ b/src/nvim/testdir/test_startup_utf8.vim @@ -1,7 +1,7 @@ " Tests for startup using utf-8. source shared.vim -" source screendump.vim +source screendump.vim func Test_read_stdin_utf8() let linesin = ['テスト', '€ÀÈÌÒÙ'] diff --git a/src/nvim/testdir/test_suspend.vim b/src/nvim/testdir/test_suspend.vim index ef5a96bd72..4b3bd5eadf 100644 --- a/src/nvim/testdir/test_suspend.vim +++ b/src/nvim/testdir/test_suspend.vim @@ -1,6 +1,7 @@ " Test :suspend source shared.vim +source term_util.vim func CheckSuspended(buf, fileExists) call WaitForAssert({-> assert_match('[$#] $', term_getline(a:buf, '.'))}) @@ -55,7 +56,7 @@ func Test_suspend() call term_wait(buf) " Wait until Vim actually exited and shell shows a prompt call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) - call Stop_shell_in_terminal(buf) + call StopShellInTerminal(buf) exe buf . 'bwipe!' call delete('Xfoo') diff --git a/src/nvim/testdir/test_tabpage.vim b/src/nvim/testdir/test_tabpage.vim index ce9f7adfef..55dff3d476 100644 --- a/src/nvim/testdir/test_tabpage.vim +++ b/src/nvim/testdir/test_tabpage.vim @@ -1,6 +1,6 @@ " Tests for tabpage -" source screendump.vim +source screendump.vim function Test_tabpage() bw! diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 40376a877e..cffd80ff4f 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -5,7 +5,7 @@ if !has('timers') endif source shared.vim -source screendump.vim +source term_util.vim source load.vim func MyHandler(timer) diff --git a/src/nvim/testdir/view_util.vim b/src/nvim/testdir/view_util.vim index 520f65c1e7..1def201a05 100644 --- a/src/nvim/testdir/view_util.vim +++ b/src/nvim/testdir/view_util.vim @@ -1,10 +1,21 @@ " Functions about view shared by several tests " Only load this script once. -if exists('*ScreenLines') +if exists('*Screenline') finish endif +" Get line "lnum" as displayed on the screen. +" Trailing white space is trimmed. +func Screenline(lnum) + let chars = [] + for c in range(1, winwidth(0)) + call add(chars, nr2char(screenchar(a:lnum, c))) + endfor + let line = join(chars, '') + return matchstr(line, '^.\{-}\ze\s*$') +endfunc + " ScreenLines(lnum, width) or " ScreenLines([start, end], width) function! ScreenLines(lnum, width) abort |