diff options
Diffstat (limited to 'test/functional/shada/variables_spec.lua')
-rw-r--r-- | test/functional/shada/variables_spec.lua | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua index a91b7eb193..49dd5837a7 100644 --- a/test/functional/shada/variables_spec.lua +++ b/test/functional/shada/variables_spec.lua @@ -22,8 +22,7 @@ describe('ShaDa support code', function() end) local autotest = function(tname, varname, varval, val_is_expr) - it('is able to dump and read back ' .. tname .. ' variable automatically', - function() + it('is able to dump and read back ' .. tname .. ' variable automatically', function() reset('set shada+=!') if val_is_expr then nvim_command('let g:' .. varname .. ' = ' .. varval) @@ -44,8 +43,8 @@ describe('ShaDa support code', function() autotest('string', 'STRVAR', 'foo') autotest('number', 'NUMVAR', 42) autotest('float', 'FLTVAR', 42.5) - autotest('dictionary', 'DCTVAR', {a=10}) - autotest('list', 'LSTVAR', {{a=10}, {b=10.5}, {c='str'}}) + autotest('dictionary', 'DCTVAR', { a = 10 }) + autotest('list', 'LSTVAR', { { a = 10 }, { b = 10.5 }, { c = 'str' } }) autotest('true', 'TRUEVAR', true) autotest('false', 'FALSEVAR', false) autotest('null', 'NULLVAR', 'v:null', true) @@ -92,42 +91,43 @@ describe('ShaDa support code', function() eq(0, funcs.exists('g:str_var')) end) - it('dumps and loads variables correctly with utf-8 strings', - function() + it('dumps and loads variables correctly with utf-8 strings', function() reset() meths.set_var('STRVAR', '«') - meths.set_var('LSTVAR', {'«'}) - meths.set_var('DCTVAR', {['«']='«'}) - meths.set_var('NESTEDVAR', {['«']={{'«'}, {['«']='«'}, {a='Test'}}}) + meths.set_var('LSTVAR', { '«' }) + meths.set_var('DCTVAR', { ['«'] = '«' }) + meths.set_var('NESTEDVAR', { ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } }) expect_exit(nvim_command, 'qall') reset() eq('«', meths.get_var('STRVAR')) - eq({'«'}, meths.get_var('LSTVAR')) - eq({['«']='«'}, meths.get_var('DCTVAR')) - eq({['«']={{'«'}, {['«']='«'}, {a='Test'}}}, meths.get_var('NESTEDVAR')) + eq({ '«' }, meths.get_var('LSTVAR')) + eq({ ['«'] = '«' }, meths.get_var('DCTVAR')) + eq({ ['«'] = { { '«' }, { ['«'] = '«' }, { a = 'Test' } } }, meths.get_var('NESTEDVAR')) end) - it('dumps and loads variables correctly with 8-bit strings', - function() + it('dumps and loads variables correctly with 8-bit strings', function() reset() -- \171 is U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK in 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'}}}) + meths.set_var('LSTVAR', { '\171' }) + meths.set_var('DCTVAR', { ['«\171'] = '«\171' }) + meths.set_var( + 'NESTEDVAR', + { ['\171'] = { { '\171«' }, { ['\171'] = '\171' }, { a = 'Test' } } } + ) expect_exit(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')) + 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('ignore when a funcref is stored in a variable', - function() + it('ignore when a funcref is stored in a variable', function() nvim_command('let F = function("tr")') meths.set_var('U', '10') nvim_command('set shada+=!') @@ -138,8 +138,7 @@ describe('ShaDa support code', function() eq('10', meths.get_var('U')) end) - it('ignore when a partial is stored in a variable', - function() + it('ignore when a partial is stored in a variable', function() nvim_command('let P = { -> 1 }') meths.set_var('U', '10') nvim_command('set shada+=!') @@ -150,8 +149,7 @@ describe('ShaDa support code', function() eq('10', meths.get_var('U')) end) - it('ignore when a self-referencing list is stored in a variable', - function() + it('ignore when a self-referencing list is stored in a variable', function() meths.set_var('L', {}) nvim_command('call add(L, L)') meths.set_var('U', '10') |