aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/storage_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/storage_spec.lua b/tests/storage_spec.lua
new file mode 100644
index 0000000..7da2bf7
--- /dev/null
+++ b/tests/storage_spec.lua
@@ -0,0 +1,9 @@
+-- Can be run under Neovim with: nvim --headless -u NONE -l tests/storage_spec.lua
+vim.opt.rtp:prepend(vim.fn.getcwd())
+local s = require('extregs.storage')
+local reg = { lines = { 'one', 'two' }, type = 'V', size = 2 }
+local got = s.decode(s.encode(reg))
+assert(vim.deep_equal(got, reg))
+assert(vim.deep_equal(s.decode('hello'), { lines = { 'hello' }, type = 'v' }))
+assert(vim.deep_equal(s.decode('hello\nworld\n'), { lines = { 'hello', 'world' }, type = 'V' }))
+print('storage tests passed')