Compare commits

...

8 Commits

Author SHA1 Message Date
Bram Moolenaar
7a073549a3 patch 8.0.0295: test_viml hangs
Problem:    test_viml hangs.
Solution:   Put resetting 'more' before sourcing the script.
2017-02-01 23:17:36 +01:00
Bram Moolenaar
79da563cf9 patch 8.0.0294: argument list is not stored correctly in a session file
Problem:    Argument list is not stored correctly in a session file.
            (lgpasquale)
Solution:   Use "$argadd" instead of "argadd". (closes #1434)
2017-02-01 22:52:44 +01:00
Bram Moolenaar
e5f2a075e3 patch 8.0.0293: some tests have a one or three second wait
Problem:    Some tests have a one or three second wait.
Solution:   Reset the 'showmode' option.  Use a test time of one to disable
            sleep after an error or warning message.
2017-02-01 22:31:49 +01:00
Bram Moolenaar
a2f28859bf patch 8.0.0292: the stat test is a bit slow
Problem:    The stat test is a bit slow.
Solution:   Remove a couple of sleep comments and reduce another.
2017-02-01 22:05:28 +01:00
Bram Moolenaar
23fa81d222 patch 8.0.0291: Visual block insertion does not insert in all lines
Problem:    Visual block insertion does not insert in all lines.
Solution:   Don't bail out of insert too early. Add a test. (Christian
            Brabandt, closes #1290)
2017-02-01 21:50:21 +01:00
Bram Moolenaar
04e87b72c5 patch 8.0.0290: cursor positioning wrong if wide character wraps
Problem:    If a wide character doesn't fit at the end of the screen line, and
            the line doesn't fit on the screen, then the cursor position may
            be wrong. (anliting)
Solution:   Don't skip over wide character. (Christian Brabandt, closes #1408)
2017-02-01 21:23:10 +01:00
Bram Moolenaar
21d7c9b601 patch 8.0.0289: no test for "ga" and :ascii
Problem:    No test for "ga" and :ascii.
Solution:   Add a test. (Dominique Pelle, closes #1429)
2017-02-01 20:53:38 +01:00
Bram Moolenaar
4e032e1b17 patch 8.0.0288: errors reported while running tests
Problem:    Errors reported while running tests.
Solution:   Put comma in the right place.
2017-02-01 20:48:13 +01:00
13 changed files with 127 additions and 23 deletions

View File

@@ -2127,8 +2127,9 @@ test_arglist \
test_fnameescape \
test_fnamemodify \
test_fold \
test_glob2regpat \
test_ga \
test_gf \
test_glob2regpat \
test_gn \
test_goto \
test_gui \

View File

@@ -11790,7 +11790,7 @@ ses_arglist(
s = buf;
}
}
if (fputs("argadd ", fd) < 0
if (fputs("$argadd ", fd) < 0
|| ses_put_fname(fd, s, flagp) == FAIL
|| put_eol(fd) == FAIL)
{

View File

@@ -3264,7 +3264,11 @@ change_warning(
#endif
msg_clr_eos();
(void)msg_end();
if (msg_silent == 0 && !silent_mode)
if (msg_silent == 0 && !silent_mode
#ifdef FEAT_EVAL
&& time_for_testing != 1
#endif
)
{
out_flush();
ui_delay(1000L, TRUE); /* give the user time to think about it */

View File

@@ -2571,8 +2571,7 @@ op_insert(oparg_T *oap, long count1)
}
t1 = oap->start;
if (edit(NUL, FALSE, (linenr_T)count1))
return;
(void)edit(NUL, FALSE, (linenr_T)count1);
/* When a tab was inserted, and the characters in front of the tab
* have been converted to a tab as well, the column of the cursor

View File

@@ -2903,7 +2903,7 @@ win_line(
int endrow,
int nochange UNUSED) /* not updating for changed text */
{
int col; /* visual column on screen */
int col = 0; /* visual column on screen */
unsigned off; /* offset in ScreenLines/ScreenAttrs */
int c = 0; /* init for GCC */
long vcol = 0; /* virtual column (for tabs) */
@@ -3429,7 +3429,11 @@ win_line(
#else
--ptr;
#endif
n_skip = v - vcol;
#ifdef FEAT_MBYTE
/* character fits on the screen, don't need to skip it */
if ((*mb_ptr2cells)(ptr) >= c && col == 0)
#endif
n_skip = v - vcol;
}
/*

View File

@@ -88,6 +88,14 @@ endfunc
function RunTheTest(test)
echo 'Executing ' . a:test
" Avoid stopping at the "hit enter" prompt
set nomore
" Avoid a three second wait when a message is about to be overwritten by the
" mode message.
set noshowmode
if exists("*SetUp")
try
call SetUp()
@@ -158,12 +166,11 @@ let s:flaky = [
\ 'Test_communicate()',
\ 'Test_nb_basic()',
\ 'Test_pipe_through_sort_all()',
\ 'Test_pipe_through_sort_some()'
\ 'Test_pipe_through_sort_some()',
\ 'Test_reltime()',
\ ]
" Locate Test_ functions and execute them.
set nomore
redir @q
silent function /^Test_
redir END

View File

@@ -19,6 +19,7 @@ source test_float_func.vim
source test_fnamemodify.vim
source test_functions.vim
source test_glob2regpat.vim
source test_ga.vim
source test_goto.vim
source test_help_tagjump.vim
source test_join.vim

37
src/testdir/test_ga.vim Normal file
View File

@@ -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<e> 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<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401", Do_ga("e\u0301"))
call assert_equal("\n<e> 101, Hex 65, Octal 145 < ́> 769, Hex 0301, Octal 1401 < ̱> 817, Hex 0331, Octal 1461", Do_ga("e\u0301\u0331"))
call assert_equal("\n<e> 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

View File

@@ -110,4 +110,16 @@ func Test_mksession_winheight()
call delete('Xtest_mks.out')
endfunc
func Test_mksession_arglist()
argdel *
next file1 file2 file3 file4
mksession! Xtest_mks.out
source Xtest_mks.out
call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
call delete('Xtest_mks.out')
argdel *
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -2193,6 +2193,8 @@ func! Test_normal51_FileChangedRO()
if !has("autocmd")
return
endif
" Don't sleep after the warning message.
call test_settime(1)
call writefile(['foo'], 'Xreadonly.log')
new Xreadonly.log
setl ro
@@ -2202,6 +2204,7 @@ func! Test_normal51_FileChangedRO()
call assert_equal('Xreadonly.log', bufname(''))
" cleanup
call test_settime(0)
bw!
call delete("Xreadonly.log")
endfunc

View File

@@ -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 1
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<SYMLINKD> *All Users') >= 0
" Get the filetype of the symlink.
call assert_equal('dir', getftype('C:\Users\All Users'))

View File

@@ -23,3 +23,16 @@ func Test_dotregister_paste()
call assert_equal('hello world world', getline(1))
q!
endfunc
func Test_Visual_ctrl_o()
new
call setline(1, ['one', 'two', 'three'])
call cursor(1,2)
set noshowmode
set tw=0
call feedkeys("\<c-v>jjlIa\<c-\>\<c-o>:set tw=88\<cr>\<esc>", 'tx')
call assert_equal(['oane', 'tawo', 'tahree'], getline(1, 3))
call assert_equal(88, &tw)
set tw&
bw!
endfu

View File

@@ -764,6 +764,22 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
295,
/**/
294,
/**/
293,
/**/
292,
/**/
291,
/**/
290,
/**/
289,
/**/
288,
/**/
287,
/**/