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

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -1,3 +1,6 @@
" Settings for test script execution
" Always use "sh", don't use the value of "$SHELL".
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_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'}
-- 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 0123x
k combinations]])
execute('set encoding=utf-8')
execute('set re=' .. regexpengine)
-- 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()
execute('set cpo-=<')
execute('set encoding=utf8')
-- Test maparg() with a string result
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)
it('is working', function()
execute('set enc=utf8')
feed('ggdG<cr>')
source([[
function! Ch(a, op, b, expected)

View File

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

View File

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

View File

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