aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/encoding_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ex_cmds/encoding_spec.lua')
-rw-r--r--test/functional/ex_cmds/encoding_spec.lua25
1 files changed, 13 insertions, 12 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)