test/legacy: fix test_normal.vim

This commit is contained in:
Justin M. Keyes
2017-03-19 23:45:11 +01:00
parent db128974fc
commit 2f54d6927c
3 changed files with 43 additions and 39 deletions

View File

@@ -4766,10 +4766,8 @@ static void nv_ident(cmdarg_T *cap)
} }
} }
/* // Now grab the chars in the identifier
* Now grab the chars in the identifier if (cmdchar == 'K') {
*/
if (cmdchar == 'K' && !kp_ex) {
ptr = vim_strnsave(ptr, n); ptr = vim_strnsave(ptr, n);
if (kp_ex) { if (kp_ex) {
// Escape the argument properly for an Ex command // Escape the argument properly for an Ex command

View File

@@ -68,10 +68,10 @@ let $HOME = '/does/not/exist'
" Prepare for calling garbagecollect_for_testing(). " Prepare for calling garbagecollect_for_testing().
let v:testing = 1 let v:testing = 1
" Align with vim defaults. " Align Nvim defaults to Vim.
set directory^=. set directory^=.
set nohidden
set backspace= set backspace=
set nohidden smarttab noautoindent noautoread complete-=i noruler noshowcmd
function RunTheTest(test) function RunTheTest(test)
echo 'Executing ' . a:test echo 'Executing ' . a:test

View File

@@ -69,9 +69,10 @@ fun! Test_normal00_optrans()
1 1
norm! 2D norm! 2D
call assert_equal(['3 this is the third line', '4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line', ''], getline(1,'$')) call assert_equal(['3 this is the third line', '4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line', ''], getline(1,'$'))
set cpo+=# " Nvim: no "#" flag in 'cpoptions'.
norm! 4D " set cpo+=#
call assert_equal(['', '4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line', ''], getline(1,'$')) " norm! 4D
" call assert_equal(['', '4 This is a simple test: abcd', '5 This is the second line', '6 this is the third line', ''], getline(1,'$'))
" clean up " clean up
set cpo-=# set cpo-=#
@@ -79,6 +80,7 @@ fun! Test_normal00_optrans()
endfunc endfunc
func! Test_normal01_keymodel() func! Test_normal01_keymodel()
throw "skipped: Nvim regression: 'keymodel'"
call Setup_NewWindow() call Setup_NewWindow()
" Test 1: depending on 'keymodel' <s-down> does something different " Test 1: depending on 'keymodel' <s-down> does something different
50 50
@@ -431,6 +433,7 @@ func! Test_normal13_help()
endfunc endfunc
func! Test_normal14_page() func! Test_normal14_page()
throw "skipped: Nvim regression: CTRL-F with 'scrolloff'"
" basic test for Ctrl-F and Ctrl-B " basic test for Ctrl-F and Ctrl-B
call Setup_NewWindow() call Setup_NewWindow()
exe "norm! \<c-f>" exe "norm! \<c-f>"
@@ -1067,6 +1070,7 @@ func! Test_normal18_z_fold()
endfunc endfunc
func! Test_normal19_z_spell() func! Test_normal19_z_spell()
throw "skipped: Nvim 'spell' requires download"
if !has("spell") || !has('syntax') if !has("spell") || !has('syntax')
return return
endif endif
@@ -1253,7 +1257,7 @@ func! Test_normal22_zet()
" let shell = &shell " let shell = &shell
" let &shell = 'sh' " let &shell = 'sh'
call writefile(['1', '2'], 'Xfile') call writefile(['1', '2'], 'Xfile')
let args = ' -u NONE -N -U NONE -i NONE --noplugins -X --not-a-term' let args = ' --headless -u NONE -N -U NONE -i NONE --noplugins'
call system(v:progpath . args . ' -c "%d" -c ":norm! ZZ" Xfile') call system(v:progpath . args . ' -c "%d" -c ":norm! ZZ" Xfile')
let a = readfile('Xfile') let a = readfile('Xfile')
call assert_equal([], a) call assert_equal([], a)
@@ -1273,19 +1277,19 @@ endfunc
func! Test_normal23_K() func! Test_normal23_K()
" Test for K command " Test for K command
new new
call append(0, ['version8.txt', 'man', 'aa%bb', 'cc|dd']) call append(0, ['helphelp.txt', 'man', 'aa%bb', 'cc|dd'])
let k = &keywordprg let k = &keywordprg
set keywordprg=:help set keywordprg=:help
1 1
norm! VK norm! VK
call assert_equal('version8.txt', fnamemodify(bufname('%'), ':t')) call assert_equal('helphelp.txt', fnamemodify(bufname('%'), ':t'))
call assert_equal('help', &ft) call assert_equal('help', &ft)
call assert_match('\*version8.txt\*', getline('.')) call assert_match('\*helphelp.txt\*', getline('.'))
helpclose helpclose
norm! 0K norm! 0K
call assert_equal('version8.txt', fnamemodify(bufname('%'), ':t')) call assert_equal('helphelp.txt', fnamemodify(bufname('%'), ':t'))
call assert_equal('help', &ft) call assert_equal('help', &ft)
call assert_match('\*version8\.0\*', getline('.')) call assert_match('Help on help files', getline('.'))
helpclose helpclose
set keywordprg=:new set keywordprg=:new
@@ -1554,24 +1558,25 @@ fun! Test_normal29_brace()
" Test with { in cpooptions " Test with { in cpooptions
%d %d
call append(0, text) call append(0, text)
set cpo+={ " Nvim: no "{" flag in 'cpoptions'.
1 " set cpo+={
norm! 0d2} " 1
call assert_equal(['{', 'This is no paragaraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', " norm! 0d2}
\ '.IP', 'The nroff macros IP seperates a paragraph', 'That means, it must be a ''.''', " call assert_equal(['{', 'This is no paragaraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}',
\ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', " \ '.IP', 'The nroff macros IP seperates a paragraph', 'That means, it must be a ''.''',
\ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', " \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.',
\ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) " \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means',
$ " \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$'))
norm! d} " $
call assert_equal(['{', 'This is no paragaraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', " norm! d}
\ '.IP', 'The nroff macros IP seperates a paragraph', 'That means, it must be a ''.''', " call assert_equal(['{', 'This is no paragaraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}',
\ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', " \ '.IP', 'The nroff macros IP seperates a paragraph', 'That means, it must be a ''.''',
\ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', " \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.',
\ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) " \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means',
norm! gg} " \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$'))
norm! d5} " norm! gg}
call assert_equal(['{', 'This is no paragaraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', ''], getline(1,'$')) " norm! d5}
" call assert_equal(['{', 'This is no paragaraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', ''], getline(1,'$'))
" clean up " clean up
set cpo-={ set cpo-={
@@ -1889,12 +1894,13 @@ fun! Test_normal39_cw()
call assert_equal('hereZZZare some words', getline('.')) call assert_equal('hereZZZare some words', getline('.'))
norm! 1gg0elcWYYY norm! 1gg0elcWYYY
call assert_equal('hereZZZareYYYsome words', getline('.')) call assert_equal('hereZZZareYYYsome words', getline('.'))
set cpo+=w " Nvim: no "w" flag in 'cpoptions'.
call setline(1, 'here are some words') " set cpo+=w
norm! 1gg0elcwZZZ " call setline(1, 'here are some words')
call assert_equal('hereZZZ are some words', getline('.')) " norm! 1gg0elcwZZZ
norm! 1gg2elcWYYY " call assert_equal('hereZZZ are some words', getline('.'))
call assert_equal('hereZZZ areYYY some words', getline('.')) " norm! 1gg2elcWYYY
" call assert_equal('hereZZZ areYYY some words', getline('.'))
set cpo-=w set cpo-=w
norm! 2gg0cwfoo norm! 2gg0cwfoo
call assert_equal('foo', getline('.')) call assert_equal('foo', getline('.'))