From f25ab39faaf9e5e161d3c285a4af645383c5498b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.1.0846: not easy to recognize the system Vim runs on Problem: Not easy to recognize the system Vim runs on. Solution: Add more items to the features list. (Ozaki Kiichi, closes vim/vim#3855) https://github.com/vim/vim/commit/39536dd557e847e80572044c2be319db5886abe3 Some doc changes have already been applied. Some others are N/A. "moon" was removed in patch 8.2.0427 so I did not add it. --- src/nvim/eval/funcs.c | 6 ++++ src/nvim/testdir/test_functions.vim | 68 ++++++++++++++++++++++++++++--------- src/nvim/testdir/test_writefile.vim | 2 +- 3 files changed, 59 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 29619f62e9..04a1f08f04 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -4433,6 +4433,12 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) #if defined(BSD) && !defined(__APPLE__) "bsd", #endif +#ifdef __linux__ + "linux", +#endif +#ifdef SUN_SYSTEM + "sun", +#endif #ifdef UNIX "unix", #endif diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 0edbeb420a..e4c6c6a3b2 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1377,6 +1377,35 @@ func Test_func_exists_on_reload() delfunc ExistingFunction endfunc +func Test_platform_name() + " The system matches at most only one name. + let names = ['amiga', 'beos', 'bsd', 'hpux', 'linux', 'mac', 'qnx', 'sun', 'vms', 'win32', 'win32unix'] + call assert_inrange(0, 1, len(filter(copy(names), 'has(v:val)'))) + + " Is Unix? + call assert_equal(has('beos'), has('beos') && has('unix')) + call assert_equal(has('bsd'), has('bsd') && has('unix')) + call assert_equal(has('hpux'), has('hpux') && has('unix')) + call assert_equal(has('linux'), has('linux') && has('unix')) + call assert_equal(has('mac'), has('mac') && has('unix')) + call assert_equal(has('qnx'), has('qnx') && has('unix')) + call assert_equal(has('sun'), has('sun') && has('unix')) + call assert_equal(has('win32'), has('win32') && !has('unix')) + call assert_equal(has('win32unix'), has('win32unix') && has('unix')) + + if has('unix') && executable('uname') + let uname = system('uname') + call assert_equal(uname =~? 'BeOS', has('beos')) + call assert_equal(uname =~? 'BSD\|DragonFly', has('bsd')) + call assert_equal(uname =~? 'HP-UX', has('hpux')) + call assert_equal(uname =~? 'Linux', has('linux')) + call assert_equal(uname =~? 'Darwin', has('mac')) + call assert_equal(uname =~? 'QNX', has('qnx')) + call assert_equal(uname =~? 'SunOS', has('sun')) + call assert_equal(uname =~? 'CYGWIN\|MSYS', has('win32unix')) + endif +endfunc + sandbox function Fsandbox() normal ix endfunc @@ -1519,24 +1548,31 @@ func Test_libcall_libcallnr() let libc = 'msvcrt.dll' elseif has('mac') let libc = 'libSystem.B.dylib' - elseif system('uname -s') =~ 'SunOS' - " Set the path to libc.so according to the architecture. - let test_bits = system('file ' . GetVimProg()) - let test_arch = system('uname -p') - if test_bits =~ '64-bit' && test_arch =~ 'sparc' - let libc = '/usr/lib/sparcv9/libc.so' - elseif test_bits =~ '64-bit' && test_arch =~ 'i386' - let libc = '/usr/lib/amd64/libc.so' + elseif executable('ldd') + let libc = matchstr(split(system('ldd ' . GetVimProg())), '/libc\.so\>') + endif + if get(l:, 'libc', '') ==# '' + " On Unix, libc.so can be in various places. + if has('linux') + " There is not documented but regarding the 1st argument of glibc's + " dlopen an empty string and nullptr are equivalent, so using an empty + " string for the 1st argument of libcall allows to call functions. + let libc = '' + elseif has('sun') + " Set the path to libc.so according to the architecture. + let test_bits = system('file ' . GetVimProg()) + let test_arch = system('uname -p') + if test_bits =~ '64-bit' && test_arch =~ 'sparc' + let libc = '/usr/lib/sparcv9/libc.so' + elseif test_bits =~ '64-bit' && test_arch =~ 'i386' + let libc = '/usr/lib/amd64/libc.so' + else + let libc = '/usr/lib/libc.so' + endif else - let libc = '/usr/lib/libc.so' + " Unfortunately skip this test until a good way is found. + return endif - elseif system('uname -s') =~ 'OpenBSD' - let libc = 'libc.so' - else - " On Unix, libc.so can be in various places. - " Interestingly, using an empty string for the 1st argument of libcall - " allows to call functions from libc which is not documented. - let libc = '' endif if has('win32') diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim index aa7882d129..5ffbe82082 100644 --- a/src/nvim/testdir/test_writefile.vim +++ b/src/nvim/testdir/test_writefile.vim @@ -43,7 +43,7 @@ func Test_writefile_fails_gently() endfunc func Test_writefile_fails_conversion() - if !has('iconv') || system('uname -s') =~ 'SunOS' + if !has('iconv') || has('sun') return endif " Without a backup file the write won't happen if there is a conversion -- cgit From 22a7693915c15cb4822f85323961687c5e86675b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.1.0878: test for has('bsd') fails on some BSD systems Problem: Test for has('bsd') fails on some BSD systems. Solution: Adjust the uname match. (James McCoy, closes vim/vim#3909) https://github.com/vim/vim/commit/a02e3f65c52a2c8c987e7dcac5df1f8db9a7b0de --- src/nvim/testdir/test_functions.vim | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index e4c6c6a3b2..67b94d5ef8 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1397,6 +1397,8 @@ func Test_platform_name() let uname = system('uname') call assert_equal(uname =~? 'BeOS', has('beos')) call assert_equal(uname =~? 'BSD\|DragonFly', has('bsd')) + " GNU userland on BSD kernels (e.g., GNU/kFreeBSD) don't have BSD defined + call assert_equal(uname =~? '\%(GNU/k\w\+\)\@ Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.1.0884: double check for bsd systems Problem: Double check for bsd systems. Solution: Delete the old line. https://github.com/vim/vim/commit/af630d4f7f8daa7edbda0b607d32d39a5feae9d9 --- src/nvim/testdir/test_functions.vim | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 67b94d5ef8..42facdd491 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1396,7 +1396,6 @@ func Test_platform_name() if has('unix') && executable('uname') let uname = system('uname') call assert_equal(uname =~? 'BeOS', has('beos')) - call assert_equal(uname =~? 'BSD\|DragonFly', has('bsd')) " GNU userland on BSD kernels (e.g., GNU/kFreeBSD) don't have BSD defined call assert_equal(uname =~? '\%(GNU/k\w\+\)\@ Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.1.2358: tests fail on Cirrus CI for FreeBSD Problem: Tests fail on Cirrus CI for FreeBSD. Solution: Fix a test and skip some. (Christian Brabandt, closes vim/vim#5281) https://github.com/vim/vim/commit/9134f1ecd41207045db3cb47f0269497980395ad Skip test_normal.vim: already applied in #11483. --- src/nvim/testdir/check.vim | 9 +++++++++ src/nvim/testdir/test_quickfix.vim | 1 + src/nvim/testdir/test_source_utf8.vim | 4 ++++ src/nvim/testdir/test_utf8_comparisons.vim | 5 ++++- 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index ab26dddbe0..76c0f7d422 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -63,6 +63,15 @@ func CheckUnix() endif endfunc +" Command to check for not running on a BSD system. +" TODO: using this checks should not be needed +command CheckNotBSD call CheckNotBSD() +func CheckNotBSD() + if has('bsd') + throw 'Skipped: does not work on BSD' + endif +endfunc + " Command to check that making screendumps is supported. " Caller must source screendump.vim command CheckScreendump call CheckScreendump() diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 6db679c5f9..5cb0354dce 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1789,6 +1789,7 @@ func s:create_test_file(filename) endfunc func Test_switchbuf() + CheckNotBSD call s:create_test_file('Xqftestfile1') call s:create_test_file('Xqftestfile2') call s:create_test_file('Xqftestfile3') diff --git a/src/nvim/testdir/test_source_utf8.vim b/src/nvim/testdir/test_source_utf8.vim index e93ea29dff..99cb09c50e 100644 --- a/src/nvim/testdir/test_source_utf8.vim +++ b/src/nvim/testdir/test_source_utf8.vim @@ -1,7 +1,10 @@ " Test the :source! command +source check.vim func Test_source_utf8() " check that sourcing a script with 0x80 as second byte works + " does not work correctly on BSD + CheckNotBSD new call setline(1, [':%s/àx/--à1234--/g', ':%s/Àx/--À1234--/g']) write! Xscript @@ -31,6 +34,7 @@ endfunc " Test for sourcing a file with CTRL-V's at the end of the line func Test_source_ctrl_v() + CheckNotBSD call writefile(['map __1 afirst', \ 'map __2 asecond', \ 'map __3 athird', diff --git a/src/nvim/testdir/test_utf8_comparisons.vim b/src/nvim/testdir/test_utf8_comparisons.vim index fdf9d80802..62947c6e6e 100644 --- a/src/nvim/testdir/test_utf8_comparisons.vim +++ b/src/nvim/testdir/test_utf8_comparisons.vim @@ -86,6 +86,9 @@ endfunc " test that g~ap changes one paragraph only. func Test_gap() new - call feedkeys("iabcd\n\ndefggg0g~ap", "tx") + " setup text + call feedkeys("iabcd\\defg", "tx") + " modify only first line + call feedkeys("gg0g~ap", "tx") call assert_equal(["ABCD", "", "defg"], getline(1,3)) endfunc -- cgit From 94eaf3cb2fa548c0fa3132824baf6284f7e6bfee Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.2.0305: relativenumber test fails on some systems Problem: Relativenumber test fails on some systems. (James McCoy) Solution: Clear the command line. https://github.com/vim/vim/commit/8040a7147f5b896a702d1684e7831df107490f45 --- src/nvim/testdir/test_number.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_number.vim b/src/nvim/testdir/test_number.vim index d737ebe9f0..dfbdc0bffd 100644 --- a/src/nvim/testdir/test_number.vim +++ b/src/nvim/testdir/test_number.vim @@ -284,10 +284,10 @@ func Test_relativenumber_colors() " Default colors call VerifyScreenDump(buf, 'Test_relnr_colors_1', {}) - call term_sendkeys(buf, ":hi LineNrAbove ctermfg=blue\") + call term_sendkeys(buf, ":hi LineNrAbove ctermfg=blue\:\") call VerifyScreenDump(buf, 'Test_relnr_colors_2', {}) - call term_sendkeys(buf, ":hi LineNrBelow ctermfg=green\") + call term_sendkeys(buf, ":hi LineNrBelow ctermfg=green\:\") call VerifyScreenDump(buf, 'Test_relnr_colors_3', {}) call term_sendkeys(buf, ":hi clear LineNrAbove\") -- cgit From a998b24c568048f0e61052380605e15bc1fbec75 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.2.0352: FreeBSD: test for sourcing utf-8 is skipped Problem: FreeBSD: test for sourcing utf-8 is skipped. Solution: Run the matchadd_conceal test separately to avoid that setting 'term' to "ansi" causes problems for other tests. (Ozaki Kiichi, closes vim/vim#5721) https://github.com/vim/vim/commit/36ddf9383181f93b080eb26121bdff37e394d2db --- src/nvim/testdir/test_alot_utf8.vim | 1 - src/nvim/testdir/test_source_utf8.vim | 29 +++++++++++++---------------- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_alot_utf8.vim b/src/nvim/testdir/test_alot_utf8.vim index 70f14320a6..77f5ede4c8 100644 --- a/src/nvim/testdir/test_alot_utf8.vim +++ b/src/nvim/testdir/test_alot_utf8.vim @@ -6,7 +6,6 @@ source test_charsearch_utf8.vim source test_expr_utf8.vim -source test_matchadd_conceal_utf8.vim source test_mksession_utf8.vim source test_regexp_utf8.vim source test_source_utf8.vim diff --git a/src/nvim/testdir/test_source_utf8.vim b/src/nvim/testdir/test_source_utf8.vim index 99cb09c50e..66fabe0442 100644 --- a/src/nvim/testdir/test_source_utf8.vim +++ b/src/nvim/testdir/test_source_utf8.vim @@ -3,8 +3,6 @@ source check.vim func Test_source_utf8() " check that sourcing a script with 0x80 as second byte works - " does not work correctly on BSD - CheckNotBSD new call setline(1, [':%s/àx/--à1234--/g', ':%s/Àx/--À1234--/g']) write! Xscript @@ -34,25 +32,24 @@ endfunc " Test for sourcing a file with CTRL-V's at the end of the line func Test_source_ctrl_v() - CheckNotBSD - call writefile(['map __1 afirst', - \ 'map __2 asecond', - \ 'map __3 athird', - \ 'map __4 afourth', - \ 'map __5 afifth', - \ "map __1 asd\", - \ "map __2 asd\\", - \ "map __3 asd\\", - \ "map __4 asd\\\", - \ "map __5 asd\\\", - \ ], 'Xtestfile') + call writefile(['map __1 afirst', + \ 'map __2 asecond', + \ 'map __3 athird', + \ 'map __4 afourth', + \ 'map __5 afifth', + \ "map __1 asd\", + \ "map __2 asd\\", + \ "map __3 asd\\", + \ "map __4 asd\\\", + \ "map __5 asd\\\", + \ ], 'Xtestfile') source Xtestfile enew! exe "normal __1\\__2\__3\\__4\__5\" exe "%s/\/0/g" call assert_equal(['sd', - \ "map __2 asd\secondsd\sd0map __5 asd0fifth"], - \ getline(1, 2)) + \ "map __2 asd\secondsd\sd0map __5 asd0fifth"], + \ getline(1, 2)) enew! call delete('Xtestfile') -- cgit From 7c3064d46e9e525a3632e7622e192cb5402b05df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Feb 2022 09:23:54 +0800 Subject: vim-patch:8.2.0687: some tests do not work on FreeBSD Problem: Some tests do not work on FreeBSD. Solution: Enable modeline. Use WaitFor() in more cases. (Ozaki Kiichi, closes vim/vim#6036) https://github.com/vim/vim/commit/41d4299f26cc98e253f9c63f8adc9dbb9d49ed5c --- src/nvim/testdir/test_quickfix.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 5cb0354dce..f137ed5346 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -1789,7 +1789,6 @@ func s:create_test_file(filename) endfunc func Test_switchbuf() - CheckNotBSD call s:create_test_file('Xqftestfile1') call s:create_test_file('Xqftestfile2') call s:create_test_file('Xqftestfile3') @@ -1915,6 +1914,7 @@ func Test_switchbuf() " If opening a file changes 'switchbuf', then the new value should be " retained. + set modeline&vim call writefile(["vim: switchbuf=split"], 'Xqftestfile1') enew | only set switchbuf&vim -- cgit