diff options
| author | James McCoy <jamessan@jamessan.com> | 2016-11-15 16:28:23 -0500 | 
|---|---|---|
| committer | James McCoy <jamessan@jamessan.com> | 2016-12-28 14:57:37 -0500 | 
| commit | 92c7c42f7c2aab4b5f00b5d3785c06a3e2834c28 (patch) | |
| tree | 5a7bfae4e66469488fc7d3b01d5cbb8fc4f0da18 /src | |
| parent | e00b02429520ad2c8f087024900c8adce5b42d46 (diff) | |
| download | rneovim-92c7c42f7c2aab4b5f00b5d3785c06a3e2834c28.tar.gz rneovim-92c7c42f7c2aab4b5f00b5d3785c06a3e2834c28.tar.bz2 rneovim-92c7c42f7c2aab4b5f00b5d3785c06a3e2834c28.zip | |
vim-patch:7.4.2183
Problem:    Sign tests are old style.
Solution:   Turn them into new style tests. (Dominique Pelle)
https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test_signs.vim | 106 | ||||
| -rw-r--r-- | src/nvim/version.c | 2 | 
3 files changed, 108 insertions, 1 deletions
| diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 7cd1921ce1..e27be54fc9 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -40,6 +40,7 @@ NEW_TESTS = \  	    test_match.res \  	    test_matchadd_conceal.res \  	    test_quickfix.res \ +	    test_signs.res \  	    test_syntax.res \  	    test_usercommands.res \  	    test_timers.res \ diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim new file mode 100644 index 0000000000..f280a3161e --- /dev/null +++ b/src/nvim/testdir/test_signs.vim @@ -0,0 +1,106 @@ +" Test for signs + +if !has('signs') +  finish +endif + +func Test_sign() +  new +  call setline(1, ['a', 'b', 'c', 'd']) + +  sign define Sign1 text=x +  sign define Sign2 text=y + +  " Test listing signs. +  let a=execute('sign list') +  call assert_equal("\nsign Sign1 text=x \nsign Sign2 text=y ", a) + +  let a=execute('sign list Sign1') +  call assert_equal("\nsign Sign1 text=x ", a) + +  " Place the sign at line 3,then check that we can jump to it. +  exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('') +  1 +  exe 'sign jump 42 buffer=' . bufnr('') +  call assert_equal('c', getline('.')) + +  " Can't change sign. +  call assert_fails("exe 'sign place 43 name=Sign1 buffer=' . bufnr('')", 'E885:') + +  let a=execute('sign place') +  call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n    line=3  id=42  name=Sign1\n", a) + +  " Unplace the sign and try jumping to it again should now fail. +  sign unplace 42 +  1 +  call assert_fails("exe 'sign jump 42 buffer=' . bufnr('')", 'E157:') +  call assert_equal('a', getline('.')) + +  " Unplace sign on current line. +  exe 'sign place 43 line=4 name=Sign2 buffer=' . bufnr('') +  4 +  sign unplace +  let a=execute('sign place') +  call assert_equal("\n--- Signs ---\n", a) +   +  " Try again to unplace sign on current line, it should fail this time. +  call assert_fails('sign unplace', 'E159:') + +  " Unplace all signs. +  exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('') +  sign unplace * +  let a=execute('sign place') +  call assert_equal("\n--- Signs ---\n", a) + +  " After undefining the sign, we should no longer be able to place it. +  sign undefine Sign1 +  sign undefine Sign2 +  call assert_fails("exe 'sign place 42 line=3 name=Sign1 buffer=' . bufnr('')", 'E155:') + +endfunc + +func Test_sign_completion() +  sign define Sign1 text=x +  sign define Sign2 text=y + +  call feedkeys(":sign \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign define jump list place undefine unplace', @:) + +  call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign define Sign icon= linehl= text= texthl=', @:) + +  call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign define Sign linehl=SpellBad SpellCap SpellLocal SpellRare', @:) + +  call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign undefine Sign1 Sign2', @:) + +  call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign place 1 buffer= file= line= name=', @:) + +  call feedkeys(":sign place 1 name=\<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign place 1 name=Sign1 Sign2', @:) + +  call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign unplace 1 buffer= file=', @:) + +  call feedkeys(":sign list \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign list Sign1 Sign2', @:) + +  call feedkeys(":sign jump 1 \<C-A>\<C-B>\"\<CR>", 'tx') +  call assert_equal('"sign jump 1 buffer= file=', @:) + +  sign undefine Sign1 +  sign undefine Sign2 + +endfunc + +func Test_sign_invalid_commands() +  call assert_fails('sign', 'E471:') +  call assert_fails('sign xxx', 'E160:') +  call assert_fails('sign define', 'E156:') +  call assert_fails('sign undefine', 'E156:') +  call assert_fails('sign list xxx', 'E155:') +  call assert_fails('sign place 1 buffer=', 'E158:') +  call assert_fails('sign define Sign2 text=', 'E239:') +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index df3fc1cbc2..14905a7bfa 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -257,7 +257,7 @@ static int included_patches[] = {    // 2186 NA    // 2185,    // 2184, -  // 2183, +  2183,    // 2182 NA    // 2181,    // 2180, | 
