From bb7795e82065ef2e8028064c62cb542362568e19 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Wed, 22 Nov 2017 18:57:56 +0800 Subject: vim-patch:8.0.0292 (#7592) Problem: The stat test is a bit slow. Solution: Remove a couple of sleep comments and reduce another. https://github.com/vim/vim/commit/a2f28859bfb3fa52bde14c9d2ca3ab7196a9154a --- src/nvim/testdir/test_stat.vim | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index 89ca9ef379..dee0d13e84 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -1,24 +1,24 @@ " Tests for stat functions and checktime func Test_existent_file() - let fname='Xtest.tmp' + let fname = 'Xtest.tmp' - let ts=localtime() - sleep 1 - let fl=['Hello World!'] + let ts = localtime() + let fl = ['Hello World!'] call writefile(fl, fname) - let tf=getftime(fname) - sleep 1 - let te=localtime() + let tf = getftime(fname) + let te = localtime() call assert_true(ts <= tf && tf <= te) call assert_equal(strlen(fl[0] . "\n"), getfsize(fname)) call assert_equal('file', getftype(fname)) call assert_equal('rw-', getfperm(fname)[0:2]) + + call delete(fname) endfunc func Test_existent_directory() - let dname='.' + let dname = '.' call assert_equal(0, getfsize(dname)) call assert_equal('dir', getftype(dname)) @@ -26,22 +26,29 @@ func Test_existent_directory() endfunc func Test_checktime() - let fname='Xtest.tmp' + let fname = 'Xtest.tmp' - let fl=['Hello World!'] + let fl = ['Hello World!'] call writefile(fl, fname) set autoread exec 'e' fname - sleep 2 - let fl=readfile(fname) + " FAT has a granularity of 2 seconds, otherwise it's usually 1 second + if has('win32') + sleep 2 + else + sleep 2 + endif + let fl = readfile(fname) let fl[0] .= ' - checktime' call writefile(fl, fname) checktime call assert_equal(fl[0], getline(1)) + + call delete(fname) endfunc func Test_nonexistent_file() - let fname='Xtest.tmp' + let fname = 'Xtest.tmp' call delete(fname) call assert_equal(-1, getftime(fname)) @@ -55,7 +62,7 @@ func Test_win32_symlink_dir() " So we use an existing symlink for this test. if has('win32') " Check if 'C:\Users\All Users' is a symlink to a directory. - let res=system('dir C:\Users /a') + let res = system('dir C:\Users /a') if match(res, '\C *All Users') >= 0 " Get the filetype of the symlink. call assert_equal('dir', getftype('C:\Users\All Users')) -- cgit From 9393be477a733183c2a992cc8728e3ebc65a3118 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Wed, 22 Nov 2017 18:59:30 +0800 Subject: vim-patch:8.0.0289 (#7591) Problem: No test for "ga" and :ascii. Solution: Add a test. (Dominique Pelle, closes vim/vim#1429) https://github.com/vim/vim/commit/21d7c9b601f3048e1293ecd6c09b8325a15503cd --- src/nvim/testdir/Makefile | 1 + src/nvim/testdir/test_alot.vim | 1 + src/nvim/testdir/test_ga.vim | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/nvim/testdir/test_ga.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index ccf999c7ee..111bd172ef 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -42,6 +42,7 @@ NEW_TESTS ?= \ test_filter_map.res \ test_fnameescape.res \ test_fold.res \ + test_ga.res \ test_glob2regpat.res \ test_gf.res \ test_gn.res \ diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 535e290a34..c1f6405579 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -12,6 +12,7 @@ source test_filter_cmd.vim source test_filter_map.vim source test_float_func.vim source test_functions.vim +source test_ga.vim source test_goto.vim source test_jumps.vim source test_fileformat.vim diff --git a/src/nvim/testdir/test_ga.vim b/src/nvim/testdir/test_ga.vim new file mode 100644 index 0000000000..f9357ddc87 --- /dev/null +++ b/src/nvim/testdir/test_ga.vim @@ -0,0 +1,37 @@ +" Test ga normal command, and :ascii Ex command. +func Do_ga(c) + call setline(1, a:c) + let l:a = execute("norm 1goga") + let l:b = execute("ascii") + call assert_equal(l:a, l:b) + return l:a +endfunc + +func Test_ga_command() + new + set display=uhex + call assert_equal("\nNUL", Do_ga('')) + call assert_equal("\n<<01>> 1, Hex 01, Octal 001", Do_ga("\x01")) + call assert_equal("\n<<09>> 9, Hex 09, Octal 011", Do_ga("\t")) + + set display= + call assert_equal("\nNUL", Do_ga('')) + call assert_equal("\n<^A> 1, Hex 01, Octal 001", Do_ga("\x01")) + call assert_equal("\n<^I> 9, Hex 09, Octal 011", Do_ga("\t")) + + call assert_equal("\n 101, Hex 65, Octal 145", Do_ga('e')) + + if !has('multi_byte') + return + endif + + " Test a few multi-bytes characters. + call assert_equal("\n<é> 233, Hex 00e9, Octal 351", Do_ga('é')) + call assert_equal("\n<ẻ> 7867, Hex 1ebb, Octal 17273", Do_ga('ẻ')) + + " Test with combining characters. + call assert_equal("\n 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401", Do_ga("e\u0301")) + call assert_equal("\n 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461", Do_ga("e\u0301\u0331")) + call assert_equal("\n 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461 < ̸> 824, Hex 0338, Octal 1470", Do_ga("e\u0301\u0331\u0338")) + bwipe! +endfunc -- cgit From a4f6cec7a31ff8dbfa089b9e22227afbeb951e9b Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Wed, 22 Nov 2017 22:35:20 +0100 Subject: cmdline: CmdlineEnter and CmdlineLeave autocommands (#7422) vim-patch:fafcf0dd59fd patch 8.0.1206: no autocmd for entering or leaving the command line Problem: No autocmd for entering or leaving the command line. Solution: Add CmdlineEnter and CmdlineLeave. https://github.com/vim/vim/commit/fafcf0dd59fd9c4ef743bb333ae40d1d322b6079 --- src/nvim/testdir/test_autocmd.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 835df42a10..82c04abf5b 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -420,3 +420,25 @@ function Test_autocmd_bufwipe_in_SessLoadPost2() call delete(file) endfor endfunc + +func Test_Cmdline() + au! CmdlineEnter : let g:entered = expand('') + au! CmdlineLeave : let g:left = expand('') + let g:entered = 0 + let g:left = 0 + call feedkeys(":echo 'hello'\", 'xt') + call assert_equal(':', g:entered) + call assert_equal(':', g:left) + au! CmdlineEnter + au! CmdlineLeave + + au! CmdlineEnter / let g:entered = expand('') + au! CmdlineLeave / let g:left = expand('') + let g:entered = 0 + let g:left = 0 + call feedkeys("/hello", 'xt') + call assert_equal('/', g:entered) + call assert_equal('/', g:left) + au! CmdlineEnter + au! CmdlineLeave +endfunc -- cgit