aboutsummaryrefslogtreecommitdiff
path: root/test/functional/shada/errors_spec.lua
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-07-30 15:23:37 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-15 21:19:30 +0100
commitef729fb15b34480048c44e76c29657727053101c (patch)
tree74f9f6d8536ddfeeaeacce14dd35af66765747cd /test/functional/shada/errors_spec.lua
parentaf6f454f5c3349821b20bd2f0d846f7ae7343e2e (diff)
downloadrneovim-ef729fb15b34480048c44e76c29657727053101c.tar.gz
rneovim-ef729fb15b34480048c44e76c29657727053101c.tar.bz2
rneovim-ef729fb15b34480048c44e76c29657727053101c.zip
feat(shada): restore Blob globals properly
As Strings and Blobs are encoded as msgpack BINs, the current ShaDa implementation will restore global Blob variables as Strings (or msgpack special dicts if they contain NULs). Encode an additional element with Blob globals to differentiate them from Strings so that we can restore them with the correct type. Adjust variables_spec.lua's autotest() to also check for proper type.
Diffstat (limited to 'test/functional/shada/errors_spec.lua')
-rw-r--r--test/functional/shada/errors_spec.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua
index 77a41caec7..ebfd73cf85 100644
--- a/test/functional/shada/errors_spec.lua
+++ b/test/functional/shada/errors_spec.lua
@@ -342,6 +342,11 @@ describe('ShaDa error handling', function()
eq('Vim(rshada):E575: Error while reading ShaDa file: variable entry at position 0 has wrong variable name type', exc_exec(sdrcmd()))
end)
+ it('fails on variable item with BIN value and type value != VAR_TYPE_BLOB', function()
+ wshada('\006\000\007\147\196\001\065\196\000\000')
+ eq('Vim(rshada):E575: Error while reading ShaDa file: variable entry at position 0 has wrong variable type', exc_exec(sdrcmd()))
+ end)
+
it('fails on replacement item with NIL value', function()
wshada('\003\000\001\192')
eq('Vim(rshada):E575: Error while reading ShaDa file: sub string entry at position 0 is not an array', exc_exec(sdrcmd()))