Merge pull request #10815 from blueyed/vim-8.1.1483

vim-patch:8.1.1483: skipped tests are not properly listed
This commit is contained in:
Daniel Hahler 2019-08-22 06:37:05 +02:00 committed by GitHub
commit bb50eadc84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 162 additions and 215 deletions

View File

@ -86,15 +86,14 @@ nongui: nolog $(FIXFF) $(SCRIPTS) newtests report
@echo 'set $$_exitcode = -1\nrun\nif $$_exitcode != -1\n quit\nend' > .gdbinit @echo 'set $$_exitcode = -1\nrun\nif $$_exitcode != -1\n quit\nend' > .gdbinit
report: report:
$(RUN_VIMTEST) $(NO_INITS) -u NONE -S summarize.vim messages
@echo @echo
@echo 'Test results:' @echo 'Test results:'
@/bin/sh -c "if test -f test.log; then \ @cat test_result.log
cat test.log; \ @/bin/sh -c "if test -f test.log; \
echo TEST FAILURE; \ then echo TEST FAILURE; exit 1; \
exit 1; \ else echo ALL DONE; \
else \ fi"
echo ALL DONE; \
fi"
test1.out: $(NVIM_PRG) test1.out: $(NVIM_PRG)
@ -124,6 +123,7 @@ CLEAN_FILES := *.out \
*.orig \ *.orig \
*.tlog \ *.tlog \
test.log \ test.log \
test_result.log \
messages \ messages \
$(RM_ON_RUN) \ $(RM_ON_RUN) \
$(RM_ON_START) \ $(RM_ON_START) \
@ -163,7 +163,7 @@ nolog:
# New style of tests uses Vim script with assert calls. These are easier # New style of tests uses Vim script with assert calls. These are easier
# to write and a lot easier to read and debug. # to write and a lot easier to read and debug.
# Limitation: Only works with the +eval feature. # Limitation: Only works with the +eval feature.
RUN_VIMTEST = $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin RUN_VIMTEST = $(TOOL) $(NVIM_PRG) -u unix.vim
newtests: newtestssilent newtests: newtestssilent
@/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \ @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \
@ -176,4 +176,4 @@ newtestssilent: $(NEW_TESTS)
@echo "[OLDTEST] Running" $* @echo "[OLDTEST] Running" $*
@rm -rf $*.failed test.ok $(RM_ON_RUN) @rm -rf $*.failed test.ok $(RM_ON_RUN)
@mkdir -p $(TMPDIR) @mkdir -p $(TMPDIR)
@/bin/sh runnvim.sh $(ROOT) $(NVIM_PRG) $* $(RUN_VIMTEST) -u NONE -S runtest.vim $*.vim @/bin/sh runnvim.sh $(ROOT) $(NVIM_PRG) $* $(RUN_VIMTEST) $(NO_INITS) -u NONE -S runtest.vim $*.vim

View File

@ -51,13 +51,9 @@ source setup.vim
" This also enables use of line continuation. " This also enables use of line continuation.
set nocp viminfo+=nviminfo set nocp viminfo+=nviminfo
" Use utf-8 or latin1 by default, instead of whatever the system default " Use utf-8 by default, instead of whatever the system default happens to be.
" happens to be. Individual tests can overrule this at the top of the file. " Individual tests can overrule this at the top of the file.
if has('multi_byte') set encoding=utf-8
set encoding=utf-8
else
set encoding=latin1
endif
" REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for " REDIR_TEST_TO_NULL has a very permissive SwapExists autocommand which is for
" the test_name.vim file itself. Replace it here with a more restrictive one, " the test_name.vim file itself. Replace it here with a more restrictive one,
@ -272,6 +268,9 @@ if expand('%') =~ 'test_vimscript.vim'
else else
try try
source % source %
catch /^\cskipped/
call add(s:messages, ' Skipped')
call add(s:skipped, 'SKIPPED ' . expand('%') . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
catch catch
let s:fail += 1 let s:fail += 1
call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint) call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)

View File

@ -0,0 +1,56 @@
if 1
" This is executed only with the eval feature
set nocompatible
func Count(match, type)
if a:type ==# 'executed'
let g:executed += (a:match+0)
elseif a:type ==# 'failed'
let g:failed += a:match+0
elseif a:type ==# 'skipped'
let g:skipped += 1
call extend(g:skipped_output, ["\t".a:match])
endif
endfunc
let g:executed = 0
let g:skipped = 0
let g:failed = 0
let g:skipped_output = []
let g:failed_output = []
let output = [""]
try
" This uses the :s command to just fetch and process the output of the
" tests, it doesn't acutally replace anything.
" And it uses "silent" to avoid reporting the number of matches.
silent %s/^Executed\s\+\zs\d\+\ze\s\+tests/\=Count(submatch(0),'executed')/egn
silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn
silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn
call extend(output, ["Skipped:"])
call extend(output, skipped_output)
call extend(output, [
\ "",
\ "-------------------------------",
\ printf("Executed: %5d Tests", g:executed),
\ printf(" Skipped: %5d Tests", g:skipped),
\ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed),
\ "",
\ ])
if filereadable('test.log')
" outputs and indents the failed test result
call extend(output, ["", "Failures: "])
let failed_output = filter(readfile('test.log'), { v,k -> !empty(k)})
call extend(output, map(failed_output, { v,k -> "\t".k}))
" Add a final newline
call extend(output, [""])
endif
catch " Catch-all
finally
call writefile(output, 'test_result.log') " overwrites an existing file
endtry
endif
q!

View File

@ -2,8 +2,7 @@
" This makes testing go faster, since Vim doesn't need to restart. " This makes testing go faster, since Vim doesn't need to restart.
" These tests use utf8 'encoding'. Setting 'encoding' is already done in " These tests use utf8 'encoding'. Setting 'encoding' is already done in
" runtest.vim. Checking for the multi_byte feature is in the individual " runtest.vim.
" files, so that they can be run by themselves.
source test_charsearch_utf8.vim source test_charsearch_utf8.vim
source test_expr_utf8.vim source test_expr_utf8.vim

View File

@ -2,8 +2,8 @@
" NOTE: This just checks if the code works. If you know Arabic please add " NOTE: This just checks if the code works. If you know Arabic please add
" functional tests that check the shaping works with real text. " functional tests that check the shaping works with real text.
if !has('arabic') || !has('multi_byte') if !has('arabic')
finish throw 'Skipped: arabic feature missing'
endif endif
source view_util.vim source view_util.vim

View File

@ -1,7 +1,7 @@
" Test 'autochdir' behavior " Test 'autochdir' behavior
if !exists("+autochdir") if !exists("+autochdir")
finish throw 'Skipped: autochdir feature missing'
endif endif
func Test_set_filename() func Test_set_filename()

View File

@ -5,7 +5,7 @@
" It helps to change the tabstop setting and force a redraw (e.g. see " It helps to change the tabstop setting and force a redraw (e.g. see
" Test_breakindent08()) " Test_breakindent08())
if !exists('+breakindent') if !exists('+breakindent')
finish throw 'Skipped: breakindent option not supported'
endif endif
source view_util.vim source view_util.vim

View File

@ -1,7 +1,4 @@
" Tests for related f{char} and t{char} using utf-8. " Tests for related f{char} and t{char} using utf-8.
if !has('multi_byte')
finish
endif
" Test for t,f,F,T movement commands " Test for t,f,F,T movement commands
function! Test_search_cmds() function! Test_search_cmds()

View File

@ -1,7 +1,7 @@
" Tests for the +clientserver feature. " Tests for the +clientserver feature.
if !has('job') || !has('clientserver') if !has('job') || !has('clientserver')
finish throw 'Skipped: job and/or clientserver feature missing'
endif endif
source shared.vim source shared.vim

View File

@ -568,7 +568,8 @@ func Test_setcmdpos()
endfunc endfunc
func Test_cmdline_overstrike() func Test_cmdline_overstrike()
let encodings = has('multi_byte') ? [ 'utf8' ] : [ 'latin1' ] " Nvim: only utf8 is supported.
let encodings = ['utf8']
let encoding_save = &encoding let encoding_save = &encoding
for e in encodings for e in encodings
@ -587,11 +588,9 @@ func Test_cmdline_overstrike()
call assert_equal('"ab0cd3ef4', @:) call assert_equal('"ab0cd3ef4', @:)
endfor endfor
if has('multi_byte') " Test overstrike with multi-byte characters.
" Test overstrike with multi-byte characters. call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt')
call feedkeys(":\"テキストエディタ\<home>\<right>\<right>ab\<right>\<insert>cd\<enter>", 'xt') call assert_equal('"テabキcdエディタ', @:)
call assert_equal('"テabキcdエディタ', @:)
endif
let &encoding = encoding_save let &encoding = encoding_save
endfunc endfunc

View File

@ -22,7 +22,7 @@ endfunc
" Debugger tests " Debugger tests
func Test_Debugger() func Test_Debugger()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot run Vim in a terminal window'
endif endif
" Create a Vim script with some functions " Create a Vim script with some functions

View File

@ -723,7 +723,7 @@ endfunc
func Test_diff_with_cursorline() func Test_diff_with_cursorline()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot run Vim in a terminal window'
endif endif
call writefile([ call writefile([
@ -750,7 +750,7 @@ endfunc
func Test_diff_of_diff() func Test_diff_of_diff()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot run Vim in a terminal window'
endif endif
if !has("rightleft") if !has("rightleft")
throw 'Skipped: rightleft not supported' throw 'Skipped: rightleft not supported'

View File

@ -1,6 +1,6 @@
" Tests for digraphs " Tests for digraphs
if !has("digraphs") || !has("multi_byte") if !has("digraphs")
finish finish
endif endif

View File

@ -41,7 +41,7 @@ func! Test_display_foldcolumn()
endfunc endfunc
func! Test_display_foldtext_mbyte() func! Test_display_foldtext_mbyte()
if !has("folding") || !has("multi_byte") if !has("folding")
return return
endif endif
call NewWindow(10, 40) call NewWindow(10, 40)

View File

@ -37,12 +37,10 @@ func! Test_edit_01()
call assert_equal([''], getline(1,'$')) call assert_equal([''], getline(1,'$'))
%d %d
" 4) delete a multibyte character " 4) delete a multibyte character
if has("multi_byte") call setline(1, "\u0401")
call setline(1, "\u0401") call feedkeys("i\<del>\<esc>", 'tnix')
call feedkeys("i\<del>\<esc>", 'tnix') call assert_equal([''], getline(1,'$'))
call assert_equal([''], getline(1,'$')) %d
%d
endif
" 5.1) delete linebreak with 'bs' option containing eol " 5.1) delete linebreak with 'bs' option containing eol
let _bs=&bs let _bs=&bs
set bs=eol set bs=eol
@ -452,7 +450,7 @@ endfunc
func! Test_edit_CTRL_() func! Test_edit_CTRL_()
" disabled for Windows builds, why? " disabled for Windows builds, why?
if !has("multi_byte") || !has("rightleft") || has("win32") if !has("rightleft") || has("win32")
return return
endif endif
let _encoding=&encoding let _encoding=&encoding
@ -620,7 +618,7 @@ func! Test_edit_CTRL_K()
endtry endtry
call delete('Xdictionary.txt') call delete('Xdictionary.txt')
if has("multi_byte") && !has("nvim") if exists('*test_override')
call test_override("char_avail", 1) call test_override("char_avail", 1)
set showcmd set showcmd
%d %d

View File

@ -1,10 +1,5 @@
func Test_erasebackword() func Test_erasebackword()
if !has('multi_byte')
return
endif
set encoding=utf-8
enew enew
exe "normal o wwwこんにちわ世界ワールドvim \<C-W>" exe "normal o wwwこんにちわ世界ワールドvim \<C-W>"
@ -21,5 +16,4 @@ func Test_erasebackword()
call assert_equal('', getline('.')) call assert_equal('', getline('.'))
enew! enew!
set encoding&
endfunc endfunc

View File

@ -1,7 +1,4 @@
" Tests for expressions using utf-8. " Tests for expressions using utf-8.
if !has('multi_byte')
finish
endif
func Test_strgetchar() func Test_strgetchar()
call assert_equal(char2nr('á'), strgetchar('áxb', 0)) call assert_equal(char2nr('á'), strgetchar('áxb', 0))

View File

@ -706,7 +706,7 @@ endfunc
func Test_folds_with_rnu() func Test_folds_with_rnu()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot make screendumps'
endif endif
call writefile([ call writefile([

View File

@ -106,11 +106,9 @@ func Test_strwidth()
call assert_equal(4, strwidth(1234)) call assert_equal(4, strwidth(1234))
call assert_equal(5, strwidth(-1234)) call assert_equal(5, strwidth(-1234))
if has('multi_byte') call assert_equal(2, strwidth('😉'))
call assert_equal(2, strwidth('😉')) call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde'))
call assert_equal(17, strwidth('Eĥoŝanĝo ĉiuĵaŭde')) call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße'))
call assert_equal((aw == 'single') ? 6 : 7, strwidth('Straße'))
endif
call assert_fails('call strwidth({->0})', 'E729:') call assert_fails('call strwidth({->0})', 'E729:')
call assert_fails('call strwidth([])', 'E730:') call assert_fails('call strwidth([])', 'E730:')
@ -308,10 +306,8 @@ func Test_strpart()
call assert_equal('fg', strpart('abcdefg', 5, 4)) call assert_equal('fg', strpart('abcdefg', 5, 4))
call assert_equal('defg', strpart('abcdefg', 3)) call assert_equal('defg', strpart('abcdefg', 3))
if has('multi_byte') call assert_equal('lép', strpart('éléphant', 2, 4))
call assert_equal('lép', strpart('éléphant', 2, 4)) call assert_equal('léphant', strpart('éléphant', 2))
call assert_equal('léphant', strpart('éléphant', 2))
endif
endfunc endfunc
func Test_tolower() func Test_tolower()
@ -321,10 +317,6 @@ func Test_tolower()
call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
\ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) \ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
if !has('multi_byte')
return
endif
" Test with a few uppercase diacritics. " Test with a few uppercase diacritics.
call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ")) call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ"))
call assert_equal("bḃḇ", tolower("BḂḆ")) call assert_equal("bḃḇ", tolower("BḂḆ"))
@ -399,10 +391,6 @@ func Test_toupper()
call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~', call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~',
\ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
if !has('multi_byte')
return
endif
" Test with a few lowercase diacritics. " Test with a few lowercase diacritics.
call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả")) call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả"))
call assert_equal("BḂḆ", toupper("bḃḇ")) call assert_equal("BḂḆ", toupper("bḃḇ"))

View File

@ -21,10 +21,6 @@ func Test_ga_command()
call assert_equal("\n<e> 101, Hex 65, Octal 145", Do_ga('e')) 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. " Test a few multi-bytes characters.
call assert_equal("\n<é> 233, Hex 00e9, Oct 351, Digr e'", Do_ga('é')) call assert_equal("\n<é> 233, Hex 00e9, Oct 351, Digr e'", Do_ga('é'))
call assert_equal("\n<ẻ> 7867, Hex 1ebb, Oct 17273, Digr e2", Do_ga('ẻ')) call assert_equal("\n<ẻ> 7867, Hex 1ebb, Oct 17273, Digr e2", Do_ga('ẻ'))

View File

@ -532,7 +532,7 @@ endfunc
func Test_cursorline_after_yank() func Test_cursorline_after_yank()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot make screendumps'
endif endif
call writefile([ call writefile([
@ -554,7 +554,7 @@ endfunc
func Test_cursorline_with_visualmode() func Test_cursorline_with_visualmode()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot make screendumps'
endif endif
call writefile([ call writefile([

View File

@ -1,7 +1,4 @@
" Tests for 'makeencoding'. " Tests for 'makeencoding'.
if !has('multi_byte')
finish
endif
source shared.vim source shared.vim

View File

@ -1,8 +1,5 @@
" Tests for maparg(). " Tests for maparg().
" Also test utf8 map with a 0x80 byte. " Also test utf8 map with a 0x80 byte.
if !has("multi_byte")
finish
endif
function s:SID() function s:SID()
return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')) return str2nr(matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$'))

View File

@ -1,9 +1,5 @@
" Tests for mappings and abbreviations " Tests for mappings and abbreviations
if !has('multi_byte')
finish
endif
source shared.vim source shared.vim
func Test_abbreviation() func Test_abbreviation()

View File

@ -122,9 +122,6 @@ func Test_marks_cmd()
endfunc endfunc
func Test_marks_cmd_multibyte() func Test_marks_cmd_multibyte()
if !has('multi_byte')
return
endif
new Xone new Xone
call setline(1, [repeat('á', &columns)]) call setline(1, [repeat('á', &columns)])
norm! ma norm! ma

View File

@ -114,36 +114,33 @@ function Test_match()
call assert_equal([{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}], getmatches()) call assert_equal([{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}], getmatches())
call clearmatches() call clearmatches()
" call setline(1, 'abcdΣabcdef')
if has('multi_byte') call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]])
call setline(1, 'abcdΣabcdef') 1
call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]]) redraw!
1 let v1 = screenattr(1, 1)
redraw! let v4 = screenattr(1, 4)
let v1 = screenattr(1, 1) let v5 = screenattr(1, 5)
let v4 = screenattr(1, 4) let v6 = screenattr(1, 6)
let v5 = screenattr(1, 5) let v7 = screenattr(1, 7)
let v6 = screenattr(1, 6) let v8 = screenattr(1, 8)
let v7 = screenattr(1, 7) let v9 = screenattr(1, 9)
let v8 = screenattr(1, 8) let v10 = screenattr(1, 10)
let v9 = screenattr(1, 9) call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}], getmatches())
let v10 = screenattr(1, 10) call assert_notequal(v1, v4)
call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}], getmatches()) call assert_equal(v5, v4)
call assert_notequal(v1, v4) call assert_equal(v6, v1)
call assert_equal(v5, v4) call assert_equal(v7, v1)
call assert_equal(v6, v1) call assert_equal(v8, v4)
call assert_equal(v7, v1) call assert_equal(v9, v4)
call assert_equal(v8, v4) call assert_equal(v10, v1)
call assert_equal(v9, v4)
call assert_equal(v10, v1)
" Check, that setmatches() can correctly restore the matches from matchaddpos() " Check, that setmatches() can correctly restore the matches from matchaddpos()
call matchadd('MyGroup1', '\%2lmatchadd') call matchadd('MyGroup1', '\%2lmatchadd')
let m=getmatches() let m=getmatches()
call clearmatches() call clearmatches()
call setmatches(m) call setmatches(m)
call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1,9, 2]}, {'group': 'MyGroup1', 'pattern': '\%2lmatchadd', 'priority': 10, 'id': 12}], getmatches()) call assert_equal([{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1,9, 2]}, {'group': 'MyGroup1', 'pattern': '\%2lmatchadd', 'priority': 10, 'id': 12}], getmatches())
endif
highlight MyGroup1 NONE highlight MyGroup1 NONE
highlight MyGroup2 NONE highlight MyGroup2 NONE

View File

@ -1,5 +1,5 @@
" Test for matchadd() and conceal feature using utf-8. " Test for matchadd() and conceal feature using utf-8.
if !has('conceal') || !has('multi_byte') if !has('conceal')
finish finish
endif endif

View File

@ -3,7 +3,7 @@
set encoding=utf-8 set encoding=utf-8
scriptencoding utf-8 scriptencoding utf-8
if !has('multi_byte') || !has('mksession') if !has('mksession')
finish finish
endif endif

View File

@ -1374,10 +1374,6 @@ func! Test_normal23_K()
endfunc endfunc
func! Test_normal24_rot13() func! Test_normal24_rot13()
" This test uses multi byte characters
if !has("multi_byte")
return
endif
" Testing for g?? g?g? " Testing for g?? g?g?
new new
call append(0, 'abcdefghijklmnopqrstuvwxyzäüö') call append(0, 'abcdefghijklmnopqrstuvwxyzäüö')
@ -1628,10 +1624,6 @@ fun! Test_normal29_brace()
endfunc endfunc
fun! Test_normal30_changecase() fun! Test_normal30_changecase()
" This test uses multi byte characters
if !has("multi_byte")
return
endif
new new
call append(0, 'This is a simple test: äüöß') call append(0, 'This is a simple test: äüöß')
norm! 1ggVu norm! 1ggVu
@ -1901,42 +1893,36 @@ func! Test_g_ctrl_g()
call assert_equal("\nCol 1 of 10; Line 1 of 2; Word 1 of 4; Char 1 of 23; Byte 1 of 22", a) call assert_equal("\nCol 1 of 10; Line 1 of 2; Word 1 of 4; Char 1 of 23; Byte 1 of 22", a)
set bin & eol& set bin & eol&
if has('multi_byte') call setline(1, ['Français', '日本語'])
call setline(1, ['Français', '日本語'])
let a = execute(":norm! \<Esc>gojlg\<c-g>") let a = execute(":norm! \<Esc>gojlg\<c-g>")
call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20", a) call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20", a)
let a = execute(":norm! \<Esc>gojvlg\<c-g>") let a = execute(":norm! \<Esc>gojvlg\<c-g>")
call assert_equal("\nSelected 1 of 2 Lines; 1 of 2 Words; 2 of 13 Chars; 6 of 20 Bytes", a) call assert_equal("\nSelected 1 of 2 Lines; 1 of 2 Words; 2 of 13 Chars; 6 of 20 Bytes", a)
let a = execute(":norm! \<Esc>goll\<c-v>jlg\<c-g>") let a = execute(":norm! \<Esc>goll\<c-v>jlg\<c-g>")
call assert_equal("\nSelected 4 Cols; 2 of 2 Lines; 2 of 2 Words; 6 of 13 Chars; 11 of 20 Bytes", a) call assert_equal("\nSelected 4 Cols; 2 of 2 Lines; 2 of 2 Words; 6 of 13 Chars; 11 of 20 Bytes", a)
set fenc=utf8 bomb set fenc=utf8 bomb
let a = execute(":norm! \<Esc>gojlg\<c-g>") let a = execute(":norm! \<Esc>gojlg\<c-g>")
call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+3 for BOM)", a) call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+3 for BOM)", a)
set fenc=utf16 bomb set fenc=utf16 bomb
let a = execute(":norm! g\<c-g>") let a = execute(":norm! g\<c-g>")
call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+2 for BOM)", a) call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+2 for BOM)", a)
set fenc=utf32 bomb set fenc=utf32 bomb
let a = execute(":norm! g\<c-g>") let a = execute(":norm! g\<c-g>")
call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+4 for BOM)", a) call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+4 for BOM)", a)
set fenc& bomb& set fenc& bomb&
endif
set ff& set ff&
bwipe! bwipe!
endfunc endfunc
fun! Test_normal34_g_cmd3() fun! Test_normal34_g_cmd3()
if !has("multi_byte")
return
endif
" Test for g8 " Test for g8
new new
let a=execute(':norm! 1G0g8') let a=execute(':norm! 1G0g8')
@ -1955,9 +1941,6 @@ fun! Test_normal34_g_cmd3()
endfunc endfunc
func Test_normal_8g8() func Test_normal_8g8()
if !has("multi_byte")
return
endif
new new
" Test 8g8 which finds invalid utf8 at or after the cursor. " Test 8g8 which finds invalid utf8 at or after the cursor.
@ -2298,11 +2281,6 @@ func! Test_normal45_drop()
endfunc endfunc
func! Test_normal46_ignore() func! Test_normal46_ignore()
" This test uses multi byte characters
if !has("multi_byte")
return
endif
new new
" How to test this? " How to test this?
" let's just for now test, that the buffer " let's just for now test, that the buffer
@ -2475,9 +2453,7 @@ func Test_normal54_Ctrl_bsl()
call assert_equal(['abcdefghijklmn'], getline(1,'$')) call assert_equal(['abcdefghijklmn'], getline(1,'$'))
exe "norm! df\<c-\>m" exe "norm! df\<c-\>m"
call assert_equal(['abcdefghijklmn'], getline(1,'$')) call assert_equal(['abcdefghijklmn'], getline(1,'$'))
if !has("multi_byte")
return
endif
call setline(2, 'abcdefghijklmnāf') call setline(2, 'abcdefghijklmnāf')
norm! 2gg0 norm! 2gg0
exe "norm! df\<Char-0x101>" exe "norm! df\<Char-0x101>"
@ -2541,9 +2517,6 @@ func Test_changelist()
endfunc endfunc
func Test_delete_until_paragraph() func Test_delete_until_paragraph()
if !has('multi_byte')
return
endif
new new
normal grádv} normal grádv}
call assert_equal('á', getline(1)) call assert_equal('á', getline(1))

View File

@ -1,7 +1,7 @@
" Tests for complicated + argument to :edit command " Tests for complicated + argument to :edit command
function Test_edit() function Test_edit()
call writefile(["foo|bar"], "Xfile1") call writefile(["foo|bar"], "Xfile1")
call writefile(["foo/bar"], "Xfile2") call writefile(["foo/bar"], "Xfile2")
edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w
call assert_equal(["fooPIPEbar"], readfile("Xfile1")) call assert_equal(["fooPIPEbar"], readfile("Xfile1"))
call assert_equal(["fooSLASHbar"], readfile("Xfile2")) call assert_equal(["fooSLASHbar"], readfile("Xfile2"))

View File

@ -183,7 +183,7 @@ func Test_profile_errors()
endfunc endfunc
func Test_profile_truncate_mbyte() func Test_profile_truncate_mbyte()
if !has('multi_byte') || &enc !=# 'utf-8' if &enc !=# 'utf-8'
return return
endif endif

View File

@ -1,9 +1,6 @@
" Tests for put commands, e.g. ":put", "p", "gp", "P", "gP", etc. " Tests for put commands, e.g. ":put", "p", "gp", "P", "gP", etc.
func Test_put_block() func Test_put_block()
if !has('multi_byte')
return
endif
new new
call feedkeys("i\<C-V>u2500\<CR>x\<ESC>", 'x') call feedkeys("i\<C-V>u2500\<CR>x\<ESC>", 'x')
call feedkeys("\<C-V>y", 'x') call feedkeys("\<C-V>y", 'x')

View File

@ -1,9 +1,6 @@
" Tests for regexp with backslash and other special characters inside [] " Tests for regexp with backslash and other special characters inside []
" Also test backslash for hex/octal numbered character. " Also test backslash for hex/octal numbered character.
" "
if !has('multi_byte')
finish
endif
scriptencoding utf-8 scriptencoding utf-8

View File

@ -480,9 +480,6 @@ endfunc
" Test for search('multi-byte char', 'bce') " Test for search('multi-byte char', 'bce')
func Test_search_multibyte() func Test_search_multibyte()
if !has('multi_byte')
return
endif
let save_enc = &encoding let save_enc = &encoding
set encoding=utf8 set encoding=utf8
enew! enew!
@ -499,7 +496,7 @@ func Test_incsearch_substitute_dump()
return return
endif endif
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot make screendumps'
endif endif
call writefile([ call writefile([
\ 'set incsearch hlsearch scrolloff=0', \ 'set incsearch hlsearch scrolloff=0',
@ -530,7 +527,7 @@ endfunc
func Test_incsearch_with_change() func Test_incsearch_with_change()
if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal() if !has('timers') || !exists('+incsearch') || !CanRunVimInTerminal()
return throw 'Skipped: cannot make screendumps and/or timers feature and/or incsearch option missing'
endif endif
call writefile([ call writefile([

View File

@ -1,7 +1,4 @@
" Test the :source! command " Test the :source! command
if !has('multi_byte')
finish
endif
func Test_source_utf8() func Test_source_utf8()
" check that sourcing a script with 0x80 as second byte works " check that sourcing a script with 0x80 as second byte works

View File

@ -137,10 +137,8 @@ func Test_spellinfo()
set enc=cp1250 spell spelllang=en set enc=cp1250 spell spelllang=en
call assert_match("^\nfile: .*/runtime/spell/en.ascii.spl\n$", execute('spellinfo')) call assert_match("^\nfile: .*/runtime/spell/en.ascii.spl\n$", execute('spellinfo'))
if has('multi_byte') set enc=utf-8 spell spelllang=en
set enc=utf-8 spell spelllang=en call assert_match("^\nfile: .*/runtime/spell/en.utf-8.spl\n$", execute('spellinfo'))
call assert_match("^\nfile: .*/runtime/spell/en.utf-8.spl\n$", execute('spellinfo'))
endif
set enc=latin1 spell spelllang=en_us,en_nz set enc=latin1 spell spelllang=en_us,en_nz
call assert_match("^\n" . call assert_match("^\n" .

View File

@ -1,7 +1,4 @@
" Tests for startup using utf-8. " Tests for startup using utf-8.
if !has('multi_byte')
finish
endif
source shared.vim source shared.vim
" source screendump.vim " source screendump.vim
@ -66,7 +63,7 @@ endfunc
func Test_detect_ambiwidth() func Test_detect_ambiwidth()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
return throw 'Skipped: cannot run Vim in a terminal window'
endif endif
" Use the title termcap entries to output the escape sequence. " Use the title termcap entries to output the escape sequence.

View File

@ -496,8 +496,8 @@ endfunc
" Check highlighting for a small piece of C code with a screen dump. " Check highlighting for a small piece of C code with a screen dump.
func Test_syntax_c() func Test_syntax_c()
if !has('terminal') if !CanRunVimInTerminal()
return throw 'Skipped: cannot make screendumps'
endif endif
call writefile([ call writefile([
\ '/* comment line at the top */', \ '/* comment line at the top */',

View File

@ -558,7 +558,7 @@ endfunc
func Test_tabpage_cmdheight() func Test_tabpage_cmdheight()
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
throw 'Skipped: only works with terminal' throw 'Skipped: cannot make screendumps'
endif endif
call writefile([ call writefile([
\ 'set laststatus=2', \ 'set laststatus=2',

View File

@ -1,7 +1,4 @@
" Tests for Unicode manipulations " Tests for Unicode manipulations
if !has('multi_byte')
finish
endif
" Visual block Insert adjusts for multi-byte char " Visual block Insert adjusts for multi-byte char

View File

@ -1,10 +1,6 @@
" Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c) " Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
" Also test "g~ap". " Also test "g~ap".
if !has("multi_byte")
finish
endif
function! Ch(a, op, b, expected) function! Ch(a, op, b, expected)
call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected, call assert_equal(eval(printf('"%s" %s "%s"', a:a, a:op, a:b)), a:expected,
\ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected)) \ printf('"%s" %s "%s" should return %d', a:a, a:op, a:b, a:expected))

View File

@ -48,11 +48,9 @@ func Test_replace_end_of_line()
call setline(1, range(20)) call setline(1, range(20))
exe "normal! gg2jv10lr-" exe "normal! gg2jv10lr-"
call assert_equal(["1", "-----------", "3"], getline(2,4)) call assert_equal(["1", "-----------", "3"], getline(2,4))
if has('multi_byte') call setline(1, range(20))
call setline(1, range(20)) exe "normal! gg2jv10lr\<c-k>hh"
exe "normal! gg2jv10lr\<c-k>hh" call assert_equal(["1", "───────────", "3"], getline(2,4))
call assert_equal(["1", "───────────", "3"], getline(2,4))
endif
bwipe! bwipe!
set virtualedit= set virtualedit=

View File

@ -2,9 +2,6 @@
func Test_block_shift_multibyte() func Test_block_shift_multibyte()
" Uses double-wide character. " Uses double-wide character.
if !has('multi_byte')
return
endif
split split
call setline(1, ['xヹxxx', 'ヹxxx']) call setline(1, ['xヹxxx', 'ヹxxx'])
exe "normal 1G0l\<C-V>jl>" exe "normal 1G0l\<C-V>jl>"

View File

@ -1,9 +1,5 @@
" Test for wordcount() function " Test for wordcount() function
if !has('multi_byte')
finish
endif
func Test_wordcount() func Test_wordcount()
let save_enc = &enc let save_enc = &enc
set encoding=utf-8 set encoding=utf-8

View File

@ -33,7 +33,7 @@ func Test_writefile_fails_gently()
endfunc endfunc
func Test_writefile_fails_conversion() func Test_writefile_fails_conversion()
if !has('multi_byte') || !has('iconv') || system('uname -s') =~ 'SunOS' if !has('iconv') || system('uname -s') =~ 'SunOS'
return return
endif endif
" Without a backup file the write won't happen if there is a conversion " Without a backup file the write won't happen if there is a conversion