diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-11 10:10:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 10:10:33 -0500 |
commit | 77c60206df4cd1598ab030ba4a2ab26e6fbcbd83 (patch) | |
tree | f14a73c16532f20ab41f6a8028fe347d64c0fd29 | |
parent | 763de8dd8fe92d47f5d9bd13c94eb18ac21b9794 (diff) | |
download | rneovim-77c60206df4cd1598ab030ba4a2ab26e6fbcbd83.tar.gz rneovim-77c60206df4cd1598ab030ba4a2ab26e6fbcbd83.tar.bz2 rneovim-77c60206df4cd1598ab030ba4a2ab26e6fbcbd83.zip |
vim-patch:8.1.1900: sign test fails in the GUI (#13511)
Problem: Sign test fails in the GUI.
Solution: Catch and ignore the exception.
https://github.com/vim/vim/commit/d933c82ff4e2c910bd533ed9a50377699c3f5ec9
Port Test_sign_funcs() changes from patch 8.1.1899.
Test_sign_funcs_multi() in patch 8.1.1899 cannot be ported
without earlier sign patches..
N/A patches for version.c:
vim-patch:8.1.0954: arguments of semsg() and siemsg() are not checked
Problem: Arguments of semsg() and siemsg() are not checked.
Solution: Add function prototype with __attribute__.
https://github.com/vim/vim/commit/0d8562a9992e94d532485c37268ca33c0c49ecc2
vim-patch:8.2.2126: Ruby: missing function prototype
Problem: Ruby: missing function prototype.
Solution: Add the prototype.
https://github.com/vim/vim/commit/0e12140550a63bb1e45771edb89b941959440cfe
-rw-r--r-- | src/nvim/testdir/test_signs.vim | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index 2b7672f1af..1e6c311374 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -15,14 +15,8 @@ func Test_sign() " icon is ignored when not supported. "(not supported)" is shown after " the icon name when listing signs. sign define Sign1 text=x - try - sign define Sign2 text=xy texthl=Title linehl=Error - \ icon=../../pixmaps/stock_vim_find_help.png - catch /E255:/ - " Ignore error: E255: Couldn't read in sign data! - " This error can happen when running in the GUI. - " Some gui like Motif do not support the png icon format. - endtry + + call Sign_command_ignore_error('sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png') " Test listing signs. let a=execute('sign list') @@ -104,12 +98,7 @@ func Test_sign() edit foo call setline(1, ['A', 'B', 'C', 'D']) - try - sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist - \ icon=doesnotexist.xpm - catch /E255:/ - " ignore error: E255: it can happens for guis. - endtry + call Sign_command_ignore_error('sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm') let fn = expand('%:p') exe 'sign place 43 line=2 name=Sign3 file=' . fn @@ -378,6 +367,25 @@ func Test_sign_delete_buffer() sign undefine Sign endfunc +" Ignore error: E255: Couldn't read in sign data! +" This error can happen when running in the GUI. +" Some gui like Motif do not support the png icon format. +func Sign_command_ignore_error(cmd) + try + exe a:cmd + catch /E255:/ + endtry +endfunc + +" ignore error: E255: Couldn't read in sign data! +" This error can happen when running in gui. +func Sign_define_ignore_error(name, attr) + try + call sign_define(a:name, a:attr) + catch /E255:/ + endtry +endfunc + " Test for Vim script functions for managing signs func Test_sign_funcs() " Remove all the signs @@ -394,12 +402,7 @@ func Test_sign_funcs() call sign_define("sign2") let attr = {'text' : '!!', 'linehl' : 'DiffAdd', 'texthl' : 'DiffChange', \ 'icon' : 'sign2.ico'} - try - call sign_define("sign2", attr) - catch /E255:/ - " ignore error: E255: Couldn't read in sign data! - " This error can happen when running in gui. - endtry + call Sign_define_ignore_error("sign2", attr) call assert_equal([{'name' : 'sign2', 'texthl' : 'DiffChange', \ 'linehl' : 'DiffAdd', 'text' : '!!', 'icon' : 'sign2.ico'}], \ sign_getdefined("sign2")) @@ -508,6 +511,16 @@ func Test_sign_funcs() call assert_fails('call sign_undefine("none")', 'E155:') call assert_fails('call sign_undefine([])', 'E730:') + " Test for using '.' as the line number for sign_place() + call Sign_define_ignore_error("sign1", attr) + call cursor(22, 1) + call assert_equal(15, sign_place(15, '', 'sign1', 'Xsign', + \ {'lnum' : '.'})) + call assert_equal([{'bufnr' : bufnr(''), 'signs' : + \ [{'id' : 15, 'group' : '', 'lnum' : 22, 'name' : 'sign1', + \ 'priority' : 10}]}], + \ sign_getplaced('%', {'lnum' : 22})) + call delete("Xsign") call sign_unplace('*') call sign_undefine() |