encoding: Update handling of encoding in tests

Always run tests with encoding=utf-8, regardless of user locale
Don't set &encoding after startup in tests

Helped-By: Michael Reed <m.reed@mykolab.com>
This commit is contained in:
Björn Linse
2015-06-30 11:32:14 +02:00
parent e99368104a
commit ffff2c9c47
14 changed files with 11 additions and 20 deletions

View File

@@ -4,7 +4,6 @@ STARTTEST
:so small.vim :so small.vim
:" Also test a BOM is ignored. :" Also test a BOM is ignored.
:so mbyte.vim :so mbyte.vim
:set encoding=utf-8
:7/start of errorfile/,/end of errorfile/w! Xerrorfile1 :7/start of errorfile/,/end of errorfile/w! Xerrorfile1
:7/start of errorfile/,/end of errorfile/-1w! Xerrorfile2 :7/start of errorfile/,/end of errorfile/-1w! Xerrorfile2
:/start of testfile/,/end of testfile/w! Xtestfile :/start of testfile/,/end of testfile/w! Xtestfile

View File

@@ -5,8 +5,6 @@ And test "U" in Visual mode, also on German sharp S.
STARTTEST STARTTEST
:so small.vim :so small.vim
:so mbyte.vim :so mbyte.vim
:" This only works when 'encoding' is "latin1", don't depend on the environment
:set enc=latin1
/^abcde /^abcde
:" Test shift-right of a block :" Test shift-right of a block
jlllljj>wlljlll> jlllljj>wlljlll>
@@ -39,18 +37,18 @@ G$khhhhhkkcmno
:exe ":norm! l\<C-V>j$hhAab\<Esc>" :exe ":norm! l\<C-V>j$hhAab\<Esc>"
:.,/^$/w >> test.out :.,/^$/w >> test.out
:" Test for Visual block insert when virtualedit=all and utf-8 encoding :" Test for Visual block insert when virtualedit=all and utf-8 encoding
:set ve=all enc=utf-8 :set ve=all
:/\t\tline :/\t\tline
:exe ":norm! 07l\<C-V>jjIx\<Esc>" :exe ":norm! 07l\<C-V>jjIx\<Esc>"
:.,/^$/w >> test.out :.,/^$/w >> test.out
:" Test for Visual block append when virtualedit=all :" Test for Visual block append when virtualedit=all
:exe ":norm! 012l\<C-v>jjAx\<Esc>" :exe ":norm! 012l\<C-v>jjAx\<Esc>"
:set ve= enc=latin1 :set ve=
:.,/^$/w >> test.out :.,/^$/w >> test.out
:" gUe must uppercase a whole word, also when <EFBFBD> changes to SS :" gUe must uppercase a whole word, also when ß changes to SS
Gothe youtu<EFBFBD>euu endYpk0wgUe Gothe youtußeuu endYpk0wgUe
:" gUfx must uppercase until x, inclusive. :" gUfx must uppercase until x, inclusive.
O- you<EFBFBD>tu<EFBFBD>exu -0fogUfx O- youßtußexu -0fogUfx
:" VU must uppercase a whole line :" VU must uppercase a whole line
YpkVU YpkVU
:" same, when it's the last line in the buffer :" same, when it's the last line in the buffer
@@ -89,7 +87,7 @@ cccc
cccc cccc
dddd dddd
yaaa yaaa
¿¿¿ ¿¿¿
bbb bbb

Binary file not shown.

View File

@@ -5,7 +5,6 @@ Also test byteidx() and byteidxcomp()
STARTTEST STARTTEST
:so mbyte.vim :so mbyte.vim
:set encoding=utf-8
ENDTEST ENDTEST
Results of test69: Results of test69:

View File

@@ -2,7 +2,6 @@ Tests for tag search with !_TAG_FILE_ENCODING.
STARTTEST STARTTEST
:so mbyte.vim :so mbyte.vim
:set enc=utf8
:if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21" :if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21"
: e! test.ok : e! test.ok
: w! test.out : w! test.out

View File

@@ -4,7 +4,6 @@ Note: system clipboard is saved, changed and restored.
STARTTEST STARTTEST
:so small.vim :so small.vim
:set encoding=latin1
:set noswapfile :set noswapfile
:lang C :lang C
:fun AppendRegContents(reg) :fun AppendRegContents(reg)

View File

@@ -1,3 +1,6 @@
" Settings for test script execution " Settings for test script execution
" Always use "sh", don't use the value of "$SHELL". " Always use "sh", don't use the value of "$SHELL".
set shell=sh set shell=sh
" Don't depend on system locale, always use utf-8
set encoding=utf-8

View File

@@ -7,7 +7,7 @@ local Session = require('nvim.session')
local nvim_prog = os.getenv('NVIM_PROG') or 'build/bin/nvim' local nvim_prog = os.getenv('NVIM_PROG') or 'build/bin/nvim'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N', local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', 'set shortmess+=I background=light noswapfile noautoindent laststatus=1', '--cmd', 'set shortmess+=I background=light noswapfile noautoindent laststatus=1 encoding=utf-8',
'--embed'} '--embed'}
-- Formulate a path to the directory containing nvim. We use this to -- Formulate a path to the directory containing nvim. We use this to

View File

@@ -33,7 +33,6 @@ local function run_test_with_regexpengine(regexpengine)
j 0123❤x j 0123❤x
k combinations]]) k combinations]])
execute('set encoding=utf-8')
execute('set re=' .. regexpengine) execute('set re=' .. regexpengine)
-- Lines 1-8. Exercise regexp search with various magic settings. On each -- Lines 1-8. Exercise regexp search with various magic settings. On each

View File

@@ -10,7 +10,6 @@ describe('maparg()', function()
it('is working', function() it('is working', function()
execute('set cpo-=<') execute('set cpo-=<')
execute('set encoding=utf8')
-- Test maparg() with a string result -- Test maparg() with a string result
execute('map foo<C-V> is<F4>foo') execute('map foo<C-V> is<F4>foo')

View File

@@ -9,7 +9,6 @@ describe('case-insensitive string comparison in UTF-8', function()
setup(clear) setup(clear)
it('is working', function() it('is working', function()
execute('set enc=utf8')
feed('ggdG<cr>') feed('ggdG<cr>')
source([[ source([[
function! Ch(a, op, b, expected) function! Ch(a, op, b, expected)

View File

@@ -15,7 +15,7 @@ describe('regex with multi-byte', function()
Results of test95:]]) Results of test95:]])
source([=[ source([=[
set encoding=utf-8 nomore set nomore
let tl = [] let tl = []
call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna'])

View File

@@ -12,8 +12,6 @@ describe('mapping', function()
test starts here: test starts here:
]]) ]])
execute('set encoding=utf-8')
-- Abbreviations with р (0x80) should work. -- Abbreviations with р (0x80) should work.
execute('inoreab чкпр vim') execute('inoreab чкпр vim')
feed('GAчкпр <esc>') feed('GAчкпр <esc>')

View File

@@ -10,7 +10,6 @@ describe('utf8', function()
it('is working', function() it('is working', function()
insert('start:') insert('start:')
execute('set encoding=utf-8')
execute('new') execute('new')
execute('call setline(1, ["aaa", "あああ", "bbb"])') execute('call setline(1, ["aaa", "あああ", "bbb"])')