diff options
author | ZyX <kp-pav@yandex.ru> | 2016-02-06 21:03:33 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-04-18 02:46:34 +0300 |
commit | d4106f6df335b9609939d11289dd9faae2c85bb6 (patch) | |
tree | a92f5bd8a65a60ef1c1478bf60d5191fe032e917 /test/functional/shada/variables_spec.lua | |
parent | 0aa3e7b7ceb259680f9da31bd247b42cdc934449 (diff) | |
download | rneovim-d4106f6df335b9609939d11289dd9faae2c85bb6.tar.gz rneovim-d4106f6df335b9609939d11289dd9faae2c85bb6.tar.bz2 rneovim-d4106f6df335b9609939d11289dd9faae2c85bb6.zip |
shada: Make sure that NIL and EXT values can also be parsed back
Note: currently they are both *dumped*, but parsing them produces an error. This
is inappropriate: variables should either be skipped with error message when
dumping or should be read back properly.
It also appears that I did not have test for “has wrong variable value type”
error, so nothing got removed from errors_spec.
Diffstat (limited to 'test/functional/shada/variables_spec.lua')
-rw-r--r-- | test/functional/shada/variables_spec.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua index 3becf1bc32..7ceeafdc71 100644 --- a/test/functional/shada/variables_spec.lua +++ b/test/functional/shada/variables_spec.lua @@ -22,12 +22,17 @@ describe('ShaDa support code', function() eq('foo', meths.get_var('STRVAR')) end) - local autotest = function(tname, varname, varval) + local autotest = function(tname, varname, varval, val_is_expr) it('is able to dump and read back ' .. tname .. ' variable automatically', function() set_additional_cmd('set shada+=!') reset() - meths.set_var(varname, varval) + if val_is_expr then + nvim_command('let g:' .. varname .. ' = ' .. varval) + varval = meths.get_var(varname) + else + meths.set_var(varname, varval) + end -- Exit during `reset` is not a regular exit: it does not write shada -- automatically nvim_command('qall') @@ -41,6 +46,10 @@ describe('ShaDa support code', function() autotest('float', 'FLTVAR', 42.5) 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) + autotest('ext', 'EXTVAR', '{"_TYPE": v:msgpack_types.ext, "_VAL": [2, ["", ""]]}', true) it('does not read back variables without `!` in &shada', function() meths.set_var('STRVAR', 'foo') |