diff options
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/Makefile | 33 | ||||
-rw-r--r-- | src/nvim/testdir/test_assert.vim | 6 | ||||
-rw-r--r-- | src/nvim/testdir/test_diffmode.vim | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_suspend.vim | 27 |
5 files changed, 43 insertions, 28 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index fe9e0bc9c8..8b43d91e25 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -99,23 +99,24 @@ RM_ON_RUN := test.out X* viminfo RM_ON_START := test.ok RUN_VIM := $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin -s dotest.in +CLEAN_FILES := *.out \ + *.failed \ + *.res \ + *.rej \ + *.orig \ + *.tlog \ + test.log \ + messages \ + $(RM_ON_RUN) \ + $(RM_ON_START) \ + valgrind.* \ + .*.swp \ + .*.swo \ + .gdbinit \ + $(TMPDIR) \ + del clean: - -rm -rf *.out \ - *.failed \ - *.res \ - *.rej \ - *.orig \ - *.tlog \ - test.log \ - messages \ - $(RM_ON_RUN) \ - $(RM_ON_START) \ - valgrind.* \ - .*.swp \ - .*.swo \ - .gdbinit \ - $(TMPDIR) \ - del + $(RM) -rf $(CLEAN_FILES) test1.out: .gdbinit test1.in @echo "[OLDTEST-PREP] Running test1" diff --git a/src/nvim/testdir/test_assert.vim b/src/nvim/testdir/test_assert.vim index fe87bd6ef5..a4c8ce7e43 100644 --- a/src/nvim/testdir/test_assert.vim +++ b/src/nvim/testdir/test_assert.vim @@ -1,5 +1,11 @@ " Test that the methods used for testing work. +func Test_assert_fails_in_try_block() + try + call assert_equal(0, assert_fails('throw "error"')) + endtry +endfunc + " Must be last. func Test_zz_quit_detected() " Verify that if a test function ends Vim the test script detects this. diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 00f4563f3d..1ba36ca8e9 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -752,6 +752,9 @@ func Test_diff_of_diff() if !CanRunVimInTerminal() return endif + if !has("rightleft") + throw 'Skipped: rightleft not supported' + endif call writefile([ \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])', diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 28576709a3..a6ebd7b023 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -231,7 +231,7 @@ func Test_set_errors() call assert_fails('set backupcopy=', 'E474:') call assert_fails('set regexpengine=3', 'E474:') call assert_fails('set history=10001', 'E474:') - call assert_fails('set numberwidth=11', 'E474:') + call assert_fails('set numberwidth=21', 'E474:') call assert_fails('set colorcolumn=-a') call assert_fails('set colorcolumn=a') call assert_fails('set colorcolumn=1,') diff --git a/src/nvim/testdir/test_suspend.vim b/src/nvim/testdir/test_suspend.vim index e569e49055..efda68de9b 100644 --- a/src/nvim/testdir/test_suspend.vim +++ b/src/nvim/testdir/test_suspend.vim @@ -2,6 +2,20 @@ source shared.vim +func CheckSuspended(buf, fileExists) + call WaitForAssert({-> assert_match('[$#] $', term_getline(a:buf, '.'))}) + + if a:fileExists + call assert_equal(['foo'], readfile('Xfoo')) + else + " Without 'autowrite', buffer should not be written. + call assert_equal(0, filereadable('Xfoo')) + endif + + call term_sendkeys(a:buf, "fg\<CR>\<C-L>") + call WaitForAssert({-> assert_equal(' 1 foo', term_getline(a:buf, '.'))}) +endfunc + func Test_suspend() if !has('terminal') || !executable('/bin/sh') return @@ -26,13 +40,7 @@ func Test_suspend() \ "\<C-Z>"] " Suspend and wait for shell prompt. call term_sendkeys(buf, suspend_cmd) - call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) - - " Without 'autowrite', buffer should not be written. - call assert_equal(0, filereadable('Xfoo')) - - call term_sendkeys(buf, "fg\<CR>") - call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))}) + call CheckSuspended(buf, 0) endfor " Test that :suspend! with 'autowrite' writes content of buffers if modified. @@ -40,10 +48,7 @@ func Test_suspend() call assert_equal(0, filereadable('Xfoo')) call term_sendkeys(buf, ":suspend\<CR>") " Wait for shell prompt. - call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) - call assert_equal(['foo'], readfile('Xfoo')) - call term_sendkeys(buf, "fg\<CR>") - call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))}) + call CheckSuspended(buf, 1) " Quit gracefully to dump coverage information. call term_sendkeys(buf, ":qall!\<CR>") |