diff options
Diffstat (limited to 'test/functional/shada')
-rw-r--r-- | test/functional/shada/buffers_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/shada/compatibility_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/shada/errors_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/shada/helpers.lua | 12 | ||||
-rw-r--r-- | test/functional/shada/history_spec.lua | 131 | ||||
-rw-r--r-- | test/functional/shada/marks_spec.lua | 31 | ||||
-rw-r--r-- | test/functional/shada/merging_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/shada/registers_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/shada/shada_spec.lua | 25 | ||||
-rw-r--r-- | test/functional/shada/variables_spec.lua | 58 |
10 files changed, 125 insertions, 200 deletions
diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua index fd4809e01a..a4746c2205 100644 --- a/test/functional/shada/buffers_spec.lua +++ b/test/functional/shada/buffers_spec.lua @@ -1,5 +1,5 @@ -- ShaDa buffer list saving/reading support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local nvim_command, funcs, eq, curbufmeths = helpers.command, helpers.funcs, helpers.eq, helpers.curbufmeths @@ -78,13 +78,25 @@ describe('ShaDa support code', function() it('does not dump unnamed buffers', function() set_additional_cmd('set shada+=% hidden') reset() - curbufmeths.set_line(0, 'foo') + curbufmeths.set_lines(0, 1, true, {'foo'}) nvim_command('enew') - curbufmeths.set_line(0, 'bar') + curbufmeths.set_lines(0, 1, true, {'bar'}) eq(2, funcs.bufnr('$')) nvim_command('qall!') reset() eq(1, funcs.bufnr('$')) eq('', funcs.bufname(1)) end) + + it('restores 1 buffer with %1 in &shada, #5759', function() + set_additional_cmd('set shada+=%1') + reset() + nvim_command('edit ' .. testfilename) + nvim_command('edit ' .. testfilename_2) + nvim_command('qall') + reset() + eq(2, funcs.bufnr('$')) + eq('', funcs.bufname(1)) + eq(testfilename, funcs.bufname(2)) + end) end) diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua index 1fa88c58e5..1287ac010c 100644 --- a/test/functional/shada/compatibility_spec.lua +++ b/test/functional/shada/compatibility_spec.lua @@ -1,5 +1,5 @@ -- ShaDa compatibility support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq local exc_exec = helpers.exc_exec diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua index e7951ee74c..2b6b26b433 100644 --- a/test/functional/shada/errors_spec.lua +++ b/test/functional/shada/errors_spec.lua @@ -1,5 +1,5 @@ -- ShaDa errors handling support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local nvim_command, eq, exc_exec, redir_exec = helpers.command, helpers.eq, helpers.exc_exec, helpers.redir_exec @@ -17,9 +17,9 @@ describe('ShaDa error handling', function() clean() end) - -- Note: most of tests have additional items like sX, mX, rX. These are for - -- valgrind tests, to check for memory leaks (i.e. whether error handling code - -- does (not) forget to call ga_clear). Not needed for array-based items like + -- Note: most of tests have additional items like sX, mX, rX. These are for + -- valgrind tests, to check for memory leaks (i.e. whether error handling code + -- does (not) forget to call ga_clear). Not needed for array-based items like -- history because they are not using ad_ga. it('does not fail on empty file', function() @@ -69,15 +69,15 @@ describe('ShaDa error handling', function() end) it('fails on search pattern item with invalid byte', function() - -- 195 (== 0xC1) cannot start any valid messagepack entry (the only byte + -- 195 (== 0xC1) cannot start any valid messagepack entry (the only byte -- that cannot do this). Specifically unpack_template.h contains -- -- //case 0xc1: // string -- // again_terminal_trail(NEXT_CS(p), p+1); -- - -- (literally: commented out code) which means that in place of this code - -- `goto _failed` is used from default: case. I do not know any other way to - -- get MSGPACK_UNPACK_PARSE_ERROR and not MSGPACK_UNPACK_CONTINUE or + -- (literally: commented out code) which means that in place of this code + -- `goto _failed` is used from default: case. I do not know any other way to + -- get MSGPACK_UNPACK_PARSE_ERROR and not MSGPACK_UNPACK_CONTINUE or -- MSGPACK_UNPACK_EXTRA_BYTES. wshada('\002\000\001\193') eq('Vim(rshada):E576: Failed to parse ShaDa file due to a msgpack parser error at position 3', exc_exec(sdrcmd())) @@ -497,7 +497,7 @@ $ it('errors when a funcref is stored in a variable', function() nvim_command('let F = function("tr")') nvim_command('set shada+=!') - eq('\nE951: Error while dumping variable g:F, itself: attempt to dump function reference' + eq('\nE5004: Error while dumping variable g:F, itself: attempt to dump function reference' .. '\nE574: Failed to write variable F', redir_exec('wshada')) end) @@ -506,7 +506,7 @@ $ nvim_command('let L = []') nvim_command('call add(L, L)') nvim_command('set shada+=!') - eq('\nE952: Unable to dump variable g:L: container references itself in index 0' + eq('\nE5005: Unable to dump variable g:L: container references itself in index 0' .. '\nE574: Failed to write variable L', redir_exec('wshada')) end) diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua index d4eb7f57bd..8e2c0cc1f6 100644 --- a/test/functional/shada/helpers.lua +++ b/test/functional/shada/helpers.lua @@ -1,15 +1,15 @@ -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(nil) local spawn, set_session, meths, nvim_prog = helpers.spawn, helpers.set_session, helpers.meths, helpers.nvim_prog local write_file, merge_args = helpers.write_file, helpers.merge_args local mpack = require('mpack') -local tmpname = os.tmpname() +local tmpname = helpers.tmpname() local additional_cmd = '' -local function nvim_argv() - local argv = {nvim_prog, '-u', 'NONE', '-i', tmpname, '-N', +local function nvim_argv(shada_file) + local argv = {nvim_prog, '-u', 'NONE', '-i', shada_file or tmpname, '-N', '--cmd', 'set shortmess+=I background=light noswapfile', '--cmd', additional_cmd, '--embed'} @@ -20,8 +20,8 @@ local function nvim_argv() end end -local reset = function() - set_session(spawn(nvim_argv())) +local reset = function(shada_file) + set_session(spawn(nvim_argv(shada_file))) meths.set_var('tmpname', tmpname) end diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua index 94513945d0..c4be9e563d 100644 --- a/test/functional/shada/history_spec.lua +++ b/test/functional/shada/history_spec.lua @@ -1,12 +1,10 @@ -- ShaDa history saving/reading support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local nvim_command, funcs, meths, nvim_feed, eq = helpers.command, helpers.funcs, helpers.meths, helpers.feed, helpers.eq local shada_helpers = require('test.functional.shada.helpers') -local reset, set_additional_cmd, clear = - shada_helpers.reset, shada_helpers.set_additional_cmd, - shada_helpers.clear +local reset, clear = shada_helpers.reset, shada_helpers.clear describe('ShaDa support code', function() before_each(reset) @@ -173,158 +171,57 @@ describe('ShaDa support code', function() eq('goo', funcs.getline(1)) end) - it('dumps and loads history correctly when &encoding is not UTF-8', function() - set_additional_cmd('set encoding=latin1') + it('dumps and loads history with UTF-8 characters', function() 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"', funcs.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 "«"', funcs.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"', funcs.histget(':', -1)) + eq('echo "«"', funcs.histget(':', -1)) end) - it('dumps and loads replacement correctly when &encoding is not UTF-8', + it('dumps and loads replacement with UTF-8 characters', 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('substitute/./«/ge') nvim_command('qall!') reset() funcs.setline('.', {'.'}) nvim_command('&') - eq('\171', funcs.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() - funcs.setline('.', {'.'}) - nvim_command('&') eq('«', funcs.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() - funcs.setline('.', {'.'}) - nvim_command('&') - eq('\171', funcs.getline('.')) - end) - - it('dumps and loads substitute pattern correctly when &encoding is not UTF-8', + it('dumps and loads substitute pattern with UTF-8 characters', 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('substitute/«/./ge') nvim_command('qall!') reset() - funcs.setline('.', {'\171«'}) - nvim_command('&') - eq('.«', funcs.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() funcs.setline('.', {'«\171'}) nvim_command('&') eq('.\171', funcs.getline('.')) end) - it('dumps&loads s/pattern correctly when &encoding /= UTF-8 when loading', + it('dumps and loads search pattern with UTF-8 characters', 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() - funcs.setline('.', {'\171«'}) - nvim_command('&') - eq('.«', funcs.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('silent! /«/') nvim_command('set shada+=/0') nvim_command('qall!') reset() funcs.setline('.', {'\171«'}) nvim_command('~&') - eq('«', funcs.getline('.')) - eq('', funcs.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 shada+=/0') - set_additional_cmd('') - nvim_command('qall') - reset() - funcs.setline('.', {'«\171'}) - nvim_command('~&') eq('\171', funcs.getline('.')) eq('', funcs.histget('/', -1)) end) - it('dumps&loads /pattern correctly when &encoding /= UTF-8 when loading', + it('dumps and loads search pattern with 8-bit single-byte', function() -- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1 - nvim_command('silent! /«/') + nvim_command('silent! /\171/') nvim_command('set shada+=/0') - set_additional_cmd('set encoding=latin1') - nvim_command('qall') + nvim_command('qall!') reset() funcs.setline('.', {'\171«'}) nvim_command('~&') eq('«', funcs.getline('.')) eq('', funcs.histget('/', -1)) end) + end) diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index 955a6f382b..fa760ceb5b 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -1,5 +1,5 @@ -- ShaDa marks saving/reading support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local meths, curwinmeths, curbufmeths, nvim_command, funcs, eq = helpers.meths, helpers.curwinmeths, helpers.curbufmeths, helpers.command, helpers.funcs, helpers.eq @@ -100,6 +100,18 @@ describe('ShaDa support code', function() eq(2, nvim_current_line()) end) + it('is able to dump and read back mark " from a closed tab', function() + nvim_command('edit ' .. testfilename) + nvim_command('tabedit ' .. testfilename_2) + nvim_command('2') + nvim_command('q!') + nvim_command('qall') + reset() + nvim_command('edit ' .. testfilename_2) + nvim_command('normal! `"') + eq(2, nvim_current_line()) + end) + it('is able to populate v:oldfiles', function() nvim_command('edit ' .. testfilename) local tf_full = curbufmeths.get_name() @@ -139,6 +151,19 @@ describe('ShaDa support code', function() eq(saved, redir_exec('jumps')) end) + it('when dumping jump list also dumps current position', function() + nvim_command('edit ' .. testfilename) + nvim_command('normal! G') + nvim_command('split ' .. testfilename_2) + nvim_command('normal! G') + nvim_command('wshada') + nvim_command('quit') + nvim_command('rshada') + nvim_command('normal! \15') -- <C-o> + eq(testfilename_2, funcs.bufname('%')) + eq({2, 0}, curwinmeths.get_cursor()) + end) + it('is able to dump and restore jump list with different times (slow!)', function() nvim_command('edit ' .. testfilename_2) @@ -180,8 +205,8 @@ describe('ShaDa support code', function() reset() nvim_command('edit ' .. testfilename) nvim_command('normal! Gg;') - -- Note: without “sync” “commands” test has good changes to fail for unknown - -- reason (in first eq expected 1 is compared with 2). Any command inserted + -- Note: without “sync” “commands” test has good changes to fail for unknown + -- reason (in first eq expected 1 is compared with 2). Any command inserted -- causes this to work properly. nvim_command('" sync') eq(1, nvim_current_line()) diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua index 221f989409..25c73b99eb 100644 --- a/test/functional/shada/merging_spec.lua +++ b/test/functional/shada/merging_spec.lua @@ -1,5 +1,5 @@ -- ShaDa merging data support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local nvim_command, funcs, curbufmeths, eq = helpers.command, helpers.funcs, helpers.curbufmeths, helpers.eq diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua index 4043d94a69..fc812f799c 100644 --- a/test/functional/shada/registers_spec.lua +++ b/test/functional/shada/registers_spec.lua @@ -1,5 +1,5 @@ -- ShaDa registers saving/reading support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq local shada_helpers = require('test.functional.shada.helpers') @@ -128,36 +128,24 @@ describe('ShaDa support code', function() eq({{}, ''}, getreg('h')) end) - it('dumps and loads register correctly when &encoding is not UTF-8', + it('dumps and loads register correctly with utf-8 contents', function() - set_additional_cmd('set encoding=latin1') reset() - -- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1 - setreg('e', {'\171'}, 'c') + setreg('e', {'«'}, 'c') nvim_command('qall') reset() - eq({{'\171'}, 'v'}, getreg('e')) + eq({{'«'}, 'v'}, getreg('e')) end) - it('dumps and loads history correctly when &encoding /= UTF-8 when dumping', + it('dumps and loads history correctly with 8-bit single-byte', function() - set_additional_cmd('set encoding=latin1') reset() -- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1 - setreg('e', {'\171'}, 'c') + setreg('e', {'\171«'}, 'c') set_additional_cmd('') nvim_command('qall') reset() - eq({{'«'}, 'v'}, getreg('e')) + eq({{'\171«'}, '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) diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua index 683d520627..32598fc399 100644 --- a/test/functional/shada/shada_spec.lua +++ b/test/functional/shada/shada_spec.lua @@ -1,10 +1,11 @@ -- Other ShaDa tests -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local meths, nvim_command, funcs, eq = helpers.meths, helpers.command, helpers.funcs, helpers.eq local write_file, spawn, set_session, nvim_prog, exc_exec = helpers.write_file, helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.exc_exec + local lfs = require('lfs') local paths = require('test.config.paths') @@ -14,15 +15,20 @@ local shada_helpers = require('test.functional.shada.helpers') local reset, clear, get_shada_rw = shada_helpers.reset, shada_helpers.clear, shada_helpers.get_shada_rw local read_shada_file = shada_helpers.read_shada_file +local set_additional_cmd = shada_helpers.set_additional_cmd local wshada, _, shada_fname, clean = get_shada_rw('Xtest-functional-shada-shada.shada') +local dirname = 'Xtest-functional-shada-shada.d' +local dirshada = dirname .. '/main.shada' + describe('ShaDa support code', function() before_each(reset) after_each(function() clear() clean() + lfs.rmdir(dirname) end) it('preserves `s` item size limit with unknown entries', function() @@ -165,6 +171,7 @@ describe('ShaDa support code', function() end it('correctly uses shada-r option', function() + nvim_command('set shellslash') meths.set_var('__home', paths.test_source_path) nvim_command('let $HOME = __home') nvim_command('unlet __home') @@ -188,6 +195,7 @@ describe('ShaDa support code', function() end) it('correctly ignores case with shada-r option', function() + nvim_command('set shellslash') local pwd = funcs.getcwd() local relfname = 'абв/test' local fname = pwd .. '/' .. relfname @@ -230,4 +238,19 @@ describe('ShaDa support code', function() eq('', meths.get_option('viminfo')) eq('', meths.get_option('shada')) end) + + it('does not crash when ShaDa file directory is not writable', function() + if helpers.pending_win32(pending) then return end + + funcs.mkdir(dirname, '', 0) + eq(0, funcs.filewritable(dirname)) + set_additional_cmd('set shada=') + reset(dirshada) + meths.set_option('shada', '\'10') + eq('Vim(wshada):E886: System error while opening ShaDa file ' + .. 'Xtest-functional-shada-shada.d/main.shada for reading to merge ' + .. 'before writing it: permission denied', + exc_exec('wshada')) + meths.set_option('shada', '') + end) end) diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua index 7ceeafdc71..f817bcef74 100644 --- a/test/functional/shada/variables_spec.lua +++ b/test/functional/shada/variables_spec.lua @@ -1,5 +1,5 @@ -- ShaDa variables saving/reading support -local helpers = require('test.functional.helpers') +local helpers = require('test.functional.helpers')(after_each) local meths, funcs, nvim_command, eq, exc_exec = helpers.meths, helpers.funcs, helpers.command, helpers.eq, helpers.exc_exec @@ -33,7 +33,7 @@ describe('ShaDa support code', function() else meths.set_var(varname, varval) end - -- Exit during `reset` is not a regular exit: it does not write shada + -- Exit during `reset` is not a regular exit: it does not write shada -- automatically nvim_command('qall') reset() @@ -91,35 +91,13 @@ describe('ShaDa support code', function() eq(0, funcs.exists('g:str_var')) end) - it('dumps and loads variables correctly when &encoding is not UTF-8', + it('dumps and loads variables correctly with utf-8 strings', function() - set_additional_cmd('set encoding=latin1') reset() - -- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1 - meths.set_var('STRVAR', '\171') - meths.set_var('LSTVAR', {'\171'}) - meths.set_var('DCTVAR', {['\171']='\171'}) - meths.set_var('NESTEDVAR', {['\171']={{'\171'}, {['\171']='\171'}, - {a='Test'}}}) - nvim_command('qall') - reset() - eq('\171', meths.get_var('STRVAR')) - eq({'\171'}, meths.get_var('LSTVAR')) - eq({['\171']='\171'}, meths.get_var('DCTVAR')) - eq({['\171']={{'\171'}, {['\171']='\171'}, {a='Test'}}}, - meths.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 - meths.set_var('STRVAR', '\171') - meths.set_var('LSTVAR', {'\171'}) - meths.set_var('DCTVAR', {['\171']='\171'}) - meths.set_var('NESTEDVAR', {['\171']={{'\171'}, {['\171']='\171'}, - {a='Test'}}}) + meths.set_var('STRVAR', '«') + meths.set_var('LSTVAR', {'«'}) + meths.set_var('DCTVAR', {['«']='«'}) + meths.set_var('NESTEDVAR', {['«']={{'«'}, {['«']='«'}, {a='Test'}}}) set_additional_cmd('') nvim_command('qall') reset() @@ -129,20 +107,22 @@ describe('ShaDa support code', function() eq({['«']={{'«'}, {['«']='«'}, {a='Test'}}}, meths.get_var('NESTEDVAR')) end) - it('dumps and loads variables correctly when &encoding /= UTF-8 when loading', + it('dumps and loads variables correctly with 8-bit strings', function() + reset() -- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in latin1 - meths.set_var('STRVAR', '«') - meths.set_var('LSTVAR', {'«'}) - meths.set_var('DCTVAR', {['«']='«'}) - meths.set_var('NESTEDVAR', {['«']={{'«'}, {['«']='«'}, {a='Test'}}}) - set_additional_cmd('set encoding=latin1') + -- This is invalid unicode, but we should still dump and restore it. + meths.set_var('STRVAR', '\171') + meths.set_var('LSTVAR', {'\171'}) + meths.set_var('DCTVAR', {['«\171']='«\171'}) + meths.set_var('NESTEDVAR', {['\171']={{'\171«'}, {['\171']='\171'}, + {a='Test'}}}) nvim_command('qall') reset() eq('\171', meths.get_var('STRVAR')) eq({'\171'}, meths.get_var('LSTVAR')) - eq({['\171']='\171'}, meths.get_var('DCTVAR')) - eq({['\171']={{'\171'}, {['\171']='\171'}, {a='Test'}}}, + eq({['«\171']='«\171'}, meths.get_var('DCTVAR')) + eq({['\171']={{'\171«'}, {['\171']='\171'}, {a='Test'}}}, meths.get_var('NESTEDVAR')) end) @@ -152,7 +132,7 @@ describe('ShaDa support code', function() meths.set_var('U', '10') nvim_command('set shada+=!') set_additional_cmd('set shada+=!') - eq('Vim(wshada):E951: Error while dumping variable g:F, itself: attempt to dump function reference', + eq('Vim(wshada):E5004: Error while dumping variable g:F, itself: attempt to dump function reference', exc_exec('wshada')) meths.set_option('shada', '') reset() @@ -165,7 +145,7 @@ describe('ShaDa support code', function() nvim_command('call add(L, L)') meths.set_var('U', '10') nvim_command('set shada+=!') - eq('Vim(wshada):E952: Unable to dump variable g:L: container references itself in index 0', + eq('Vim(wshada):E5005: Unable to dump variable g:L: container references itself in index 0', exc_exec('wshada')) meths.set_option('shada', '') set_additional_cmd('set shada+=!') |