mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
functests: Test &encoding support
This commit is contained in:
parent
ee282cf49e
commit
c8c5da875c
@ -124,4 +124,159 @@ describe('ShaDa support code', function()
|
|||||||
nvim_command('&')
|
nvim_command('&')
|
||||||
eq('goo', nvim_eval('getline(1)'))
|
eq('goo', nvim_eval('getline(1)'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads history correctly when &encoding is not UTF-8', function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_feed(':echo "\171"\n')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq('echo "\171"', nvim_eval('histget(":", -1)'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads history correctly when &encoding /= UTF-8 when dumping',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_feed(':echo "\171"\n')
|
||||||
|
set_additional_cmd('')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq('echo "«"', nvim_eval('histget(":", -1)'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads history correctly when &encoding /= UTF-8 when loading',
|
||||||
|
function()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_feed(':echo "«"\n')
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq('echo "\171"', nvim_eval('histget(":", -1)'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads replacement correctly when &encoding is not UTF-8',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('substitute/./\171/ge')
|
||||||
|
nvim_command('qall!')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["."])')
|
||||||
|
nvim_command('&')
|
||||||
|
eq('\171', nvim_eval('getline(".")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps&loads replacement correctly when &encoding /= UTF-8 when dumping',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('substitute/./\171/ge')
|
||||||
|
set_additional_cmd('')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["."])')
|
||||||
|
nvim_command('&')
|
||||||
|
eq('«', nvim_eval('getline(".")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps&loads replacement correctly when &encoding /= UTF-8 when loading',
|
||||||
|
function()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('substitute/./«/ge')
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["."])')
|
||||||
|
nvim_command('&')
|
||||||
|
eq('\171', nvim_eval('getline(".")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads substitute pattern correctly when &encoding is not UTF-8',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('substitute/\171/./ge')
|
||||||
|
nvim_command('qall!')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["\171«"])')
|
||||||
|
nvim_command('&')
|
||||||
|
eq('.«', nvim_eval('getline(".")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps&loads s/pattern correctly when &encoding /= UTF-8 when dumping',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('substitute/\171/./ge')
|
||||||
|
set_additional_cmd('')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["«\171"])')
|
||||||
|
nvim_command('&')
|
||||||
|
eq('.\171', nvim_eval('getline(".")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps&loads s/pattern correctly when &encoding /= UTF-8 when loading',
|
||||||
|
function()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('substitute/«/./ge')
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["\171«"])')
|
||||||
|
nvim_command('&')
|
||||||
|
eq('.«', nvim_eval('getline(".")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads search pattern correctly when &encoding is not UTF-8',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('silent! /\171/')
|
||||||
|
nvim_command('set viminfo+=/0')
|
||||||
|
nvim_command('qall!')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["\171«"])')
|
||||||
|
nvim_command('~&')
|
||||||
|
eq('«', nvim_eval('getline(".")'))
|
||||||
|
eq('', nvim_eval('histget("/", -1)'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps&loads /pattern correctly when &encoding /= UTF-8 when dumping',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('silent! /\171/')
|
||||||
|
nvim_command('set viminfo+=/0')
|
||||||
|
set_additional_cmd('')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["«\171"])')
|
||||||
|
nvim_command('~&')
|
||||||
|
eq('\171', nvim_eval('getline(".")'))
|
||||||
|
eq('', nvim_eval('histget("/", -1)'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps&loads /pattern correctly when &encoding /= UTF-8 when loading',
|
||||||
|
function()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim_command('silent! /«/')
|
||||||
|
nvim_command('set viminfo+=/0')
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
nvim_eval('setline(".", ["\171«"])')
|
||||||
|
nvim_command('~&')
|
||||||
|
eq('«', nvim_eval('getline(".")'))
|
||||||
|
eq('', nvim_eval('histget("/", -1)'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -138,4 +138,37 @@ describe('ShaDa support code', function()
|
|||||||
eq({{'a', 'b', 'cde'}, 'V'}, getreg('t'))
|
eq({{'a', 'b', 'cde'}, 'V'}, getreg('t'))
|
||||||
eq({nil, ''}, getreg('h'))
|
eq({nil, ''}, getreg('h'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads register correctly when &encoding is not UTF-8',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
setreg('e', {'\171'}, 'c')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq({{'\171'}, 'v'}, getreg('e'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads history correctly when &encoding /= UTF-8 when dumping',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
setreg('e', {'\171'}, 'c')
|
||||||
|
set_additional_cmd('')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq({{'«'}, 'v'}, getreg('e'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads history correctly when &encoding /= UTF-8 when loading',
|
||||||
|
function()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
setreg('e', {'«'}, 'c')
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq({{'\171'}, 'v'}, getreg('e'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
@ -81,4 +81,59 @@ describe('ShaDa support code', function()
|
|||||||
nvim_command('rviminfo')
|
nvim_command('rviminfo')
|
||||||
eq(0, nvim_eval('exists("g:str_var")'))
|
eq(0, nvim_eval('exists("g:str_var")'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads variables correctly when &encoding is not UTF-8',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim('set_var', 'STRVAR', '\171')
|
||||||
|
nvim('set_var', 'LSTVAR', {'\171'})
|
||||||
|
nvim('set_var', 'DCTVAR', {['\171']='\171'})
|
||||||
|
nvim('set_var', 'NESTEDVAR', {['\171']={{'\171'}, {['\171']='\171'},
|
||||||
|
{a='Test'}}})
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq('\171', nvim('get_var', 'STRVAR'))
|
||||||
|
eq({'\171'}, nvim('get_var', 'LSTVAR'))
|
||||||
|
eq({['\171']='\171'}, nvim('get_var', 'DCTVAR'))
|
||||||
|
eq({['\171']={{'\171'}, {['\171']='\171'}, {a='Test'}}},
|
||||||
|
nvim('get_var', 'NESTEDVAR'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads variables correctly when &encoding /= UTF-8 when dumping',
|
||||||
|
function()
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
reset()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim('set_var', 'STRVAR', '\171')
|
||||||
|
nvim('set_var', 'LSTVAR', {'\171'})
|
||||||
|
nvim('set_var', 'DCTVAR', {['\171']='\171'})
|
||||||
|
nvim('set_var', 'NESTEDVAR', {['\171']={{'\171'}, {['\171']='\171'},
|
||||||
|
{a='Test'}}})
|
||||||
|
set_additional_cmd('')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq('«', nvim('get_var', 'STRVAR'))
|
||||||
|
eq({'«'}, nvim('get_var', 'LSTVAR'))
|
||||||
|
eq({['«']='«'}, nvim('get_var', 'DCTVAR'))
|
||||||
|
eq({['«']={{'«'}, {['«']='«'}, {a='Test'}}}, nvim('get_var', 'NESTEDVAR'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('dumps and loads variables correctly when &encoding /= UTF-8 when loading',
|
||||||
|
function()
|
||||||
|
-- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1
|
||||||
|
nvim('set_var', 'STRVAR', '«')
|
||||||
|
nvim('set_var', 'LSTVAR', {'«'})
|
||||||
|
nvim('set_var', 'DCTVAR', {['«']='«'})
|
||||||
|
nvim('set_var', 'NESTEDVAR', {['«']={{'«'}, {['«']='«'}, {a='Test'}}})
|
||||||
|
set_additional_cmd('set encoding=latin1')
|
||||||
|
nvim_command('qall')
|
||||||
|
reset()
|
||||||
|
eq('\171', nvim('get_var', 'STRVAR'))
|
||||||
|
eq({'\171'}, nvim('get_var', 'LSTVAR'))
|
||||||
|
eq({['\171']='\171'}, nvim('get_var', 'DCTVAR'))
|
||||||
|
eq({['\171']={{'\171'}, {['\171']='\171'}, {a='Test'}}},
|
||||||
|
nvim('get_var', 'NESTEDVAR'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user