vim-patch:8.2.0388: printmbcharset option not tested

Problem:    Printmbcharset option not tested.
Solution:   Add a test.  Enable PostScript for AppVeyor build. (Dominique
            Pelle, closes vim/vim#5783)
833805a486
This commit is contained in:
Jan Edmund Lazo 2021-01-01 16:22:08 -05:00
parent 85c658e388
commit 60855116f0
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -1,5 +1,7 @@
" Test :hardcopy " Test :hardcopy
source check.vim
func Test_printoptions() func Test_printoptions()
edit test_hardcopy.vim edit test_hardcopy.vim
syn on syn on
@ -28,7 +30,7 @@ func Test_printoptions()
\ ''] \ '']
exe 'set printoptions=' .. opt exe 'set printoptions=' .. opt
if has('postscript') if has('postscript')
hardcopy > Xhardcopy_printoptions 1,50hardcopy > Xhardcopy_printoptions
let lines = readfile('Xhardcopy_printoptions') let lines = readfile('Xhardcopy_printoptions')
call assert_true(len(lines) > 20, opt) call assert_true(len(lines) > 20, opt)
call assert_true(lines[0] =~ 'PS-Adobe', opt) call assert_true(lines[0] =~ 'PS-Adobe', opt)
@ -63,10 +65,34 @@ func Test_printmbfont()
bwipe bwipe
endfunc endfunc
func Test_printmbcharset()
CheckFeature postscript
" digraph.txt has plenty of non-latin1 characters.
help digraph.txt
set printmbcharset=ISO10646 printencoding=utf-8 printmbfont=r:WadaMin-Regular
hardcopy > Xhardcopy_printmbcharset
let lines = readfile('Xhardcopy_printmbcharset')
call assert_true(len(lines) > 20)
call assert_true(lines[0] =~ 'PS-Adobe')
set printmbcharset=does-not-exist printencoding=utf-8 printmbfont=r:WadaMin-Regular
call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E456:')
set printmbcharset=GB_2312-80 printencoding=utf-8 printmbfont=r:WadaMin-Regular
call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E673:')
set printmbcharset=ISO10646 printencoding=utf-8 printmbfont=
call assert_fails('hardcopy > Xhardcopy_printmbcharset', 'E675:')
call delete('Xhardcopy_printmbcharset')
set printmbcharset& printencoding& printmbfont&
bwipe
endfunc
func Test_printexpr() func Test_printexpr()
if !has('unix') CheckFeature postscript
return
endif
" Not a very useful printexpr value, but enough to test " Not a very useful printexpr value, but enough to test
" hardcopy with 'printexpr'. " hardcopy with 'printexpr'.
@ -84,7 +110,7 @@ func Test_printexpr()
\ readfile('Xhardcopy_printexpr')) \ readfile('Xhardcopy_printexpr'))
call delete('Xhardcopy_printexpr') call delete('Xhardcopy_printexpr')
" Function return 1 to test print failure. " Function returns 1 to test print failure.
function PrintFails(fname) function PrintFails(fname)
call delete(a:fname) call delete(a:fname)
return 1 return 1
@ -97,12 +123,11 @@ func Test_printexpr()
endfunc endfunc
func Test_errors() func Test_errors()
" FIXME: Windows fails differently than Unix. CheckFeature postscript
if has('unix')
edit test_hardcopy.vim edit test_hardcopy.vim
call assert_fails('hardcopy >', 'E324:') call assert_fails('hardcopy >', 'E324:')
bwipe bwipe
endif
endfunc endfunc
func Test_dark_background() func Test_dark_background()
@ -126,12 +151,11 @@ func Test_dark_background()
endfun endfun
func Test_empty_buffer() func Test_empty_buffer()
" FIXME: Unclear why this fails on Windows. CheckFeature postscript
if has('unix')
new new
call assert_equal("\nNo text to be printed", execute('hardcopy')) call assert_equal("\nNo text to be printed", execute('hardcopy'))
bwipe bwipe
endif
endfunc endfunc
func Test_printheader_parsing() func Test_printheader_parsing()
@ -145,9 +169,8 @@ func Test_printheader_parsing()
endfunc endfunc
func Test_fname_with_spaces() func Test_fname_with_spaces()
if !has('postscript') CheckFeature postscript
return
endif
split t\ e\ s\ t.txt split t\ e\ s\ t.txt
call setline(1, ['just', 'some', 'text']) call setline(1, ['just', 'some', 'text'])
hardcopy > %.ps hardcopy > %.ps
@ -157,9 +180,11 @@ func Test_fname_with_spaces()
endfunc endfunc
func Test_illegal_byte() func Test_illegal_byte()
if !has('postscript') || &enc != 'utf-8' CheckFeature postscript
if &enc != 'utf-8'
return return
endif endif
new new
" conversion of 0xff will fail, this used to cause a crash " conversion of 0xff will fail, this used to cause a crash
call setline(1, "\xff") call setline(1, "\xff")
@ -168,3 +193,5 @@ func Test_illegal_byte()
bwipe! bwipe!
call delete('Xpstest') call delete('Xpstest')
endfunc endfunc
" vim: shiftwidth=2 sts=2 expandtab