aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/encoding_spec.lua25
-rw-r--r--test/functional/helpers.lua2
2 files changed, 14 insertions, 13 deletions
diff --git a/test/functional/ex_cmds/encoding_spec.lua b/test/functional/ex_cmds/encoding_spec.lua
index 997776ca25..6d402b7974 100644
--- a/test/functional/ex_cmds/encoding_spec.lua
+++ b/test/functional/ex_cmds/encoding_spec.lua
@@ -21,20 +21,21 @@ describe('&encoding', function()
eq(3, eval('strwidth("Bär")'))
end)
- it('is not changed by `set all&`', function()
- -- we need to set &encoding to something non-default
- -- use 'latin1' when enc&vi is 'utf-8', 'utf-8' otherwise
- execute('set fenc=default')
- local enc_default, enc_other, width = eval('&fenc'), 'utf-8', 3
- if enc_default == 'utf-8' then
- enc_other = 'latin1'
- width = 4 -- utf-8 string 'Bär' will count as 4 latin1 chars
- end
+ it('can be changed before startup', function()
+ clear('set enc=latin1')
+ execute('set encoding=utf-8')
+ -- error message expected
+ feed('<cr>')
+ eq('latin1', eval('&encoding'))
+ eq(4, eval('strwidth("Bär")'))
+ end)
- clear('set enc=' .. enc_other)
+ it('is not changed by `set all&`', function()
+ -- we need to set &encoding to something non-default. Use 'latin1'
+ clear('set enc=latin1')
execute('set all&')
- eq(enc_other, eval('&encoding'))
- eq(width, eval('strwidth("Bär")'))
+ eq('latin1', eval('&encoding'))
+ eq(4, eval('strwidth("Bär")'))
end)
end)
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 67c5a6f626..50fa3fb1bd 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -8,7 +8,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 encoding=utf-8 undodir=. directory=. viewdir=. backupdir=.',
+ '--cmd', 'set shortmess+=I background=light noswapfile noautoindent laststatus=1 undodir=. directory=. viewdir=. backupdir=.',
'--embed'}
-- Formulate a path to the directory containing nvim. We use this to