~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to test/functional/ex_cmds/encoding_spec.lua

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-02-20 22:41:32 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: package-import@ubuntu.com-20160220224132-e24n8lh3yo5ylt23
Tags: upstream-0.1.2
Import upstream version 0.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    eq(3, eval('strwidth("Bär")'))
22
22
  end)
23
23
 
 
24
  it('can be changed before startup', function()
 
25
    clear('set enc=latin1')
 
26
    execute('set encoding=utf-8')
 
27
    -- error message expected
 
28
    feed('<cr>')
 
29
    eq('latin1', eval('&encoding'))
 
30
    eq(4, eval('strwidth("Bär")'))
 
31
  end)
 
32
 
24
33
  it('is not changed by `set all&`', function()
25
 
    -- we need to set &encoding to something non-default
26
 
    -- use 'latin1' when enc&vi is 'utf-8', 'utf-8' otherwise
27
 
    execute('set fenc=default')
28
 
    local enc_default, enc_other, width = eval('&fenc'), 'utf-8', 3
29
 
    if enc_default == 'utf-8' then
30
 
      enc_other = 'latin1'
31
 
      width = 4 -- utf-8 string 'Bär' will count as 4 latin1 chars
32
 
    end
33
 
 
34
 
    clear('set enc=' .. enc_other)
 
34
    -- we need to set &encoding to something non-default. Use 'latin1'
 
35
    clear('set enc=latin1')
35
36
    execute('set all&')
36
 
    eq(enc_other, eval('&encoding'))
37
 
    eq(width, eval('strwidth("Bär")'))
 
37
    eq('latin1', eval('&encoding'))
 
38
    eq(4, eval('strwidth("Bär")'))
38
39
  end)
39
40
 
40
41
end)