aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnoC <adam.r.cutler@gmail.com>2017-05-29 11:34:08 -0400
committerAdnoC <adam.r.cutler@gmail.com>2017-05-31 13:31:05 -0400
commit5908f562dfe9dfcbf1218b2820addff117ee4847 (patch)
tree6fb03c07e6d033faf853e9a0e6a0c5611bc52e96
parent0c3dea5c4d86a8ef61363034877bde04a0e99463 (diff)
downloadrneovim-5908f562dfe9dfcbf1218b2820addff117ee4847.tar.gz
rneovim-5908f562dfe9dfcbf1218b2820addff117ee4847.tar.bz2
rneovim-5908f562dfe9dfcbf1218b2820addff117ee4847.zip
test: Fix and add cases for unnamed register
Also: Add ru to shada tests with all keys Add test for unset unnamed and register 0
-rw-r--r--test/functional/legacy/eval_spec.lua6
-rw-r--r--test/functional/plugin/shada_spec.lua13
-rw-r--r--test/functional/shada/registers_spec.lua13
3 files changed, 27 insertions, 5 deletions
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index 1b6f834019..c5d38d6d05 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -517,11 +517,11 @@ describe('eval', function()
end)
it('sets the unnamed register when the "u" option is passed to setreg', function()
- execute("call setreg('a','a reg', 'cu')")
+ command("call setreg('a','a reg', 'cu')")
eq("a reg", eval('@"'))
- execute("call setreg('b','b reg', 'cu')")
+ command("call setreg('b','b reg', 'cu')")
eq("b reg", eval('@"'))
- execute("call setreg('c','c reg', 'c')")
+ command("call setreg('c','c reg', 'c')")
eq("b reg", eval('@"'))
end)
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index bf37fbabc5..639833071b 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -179,6 +179,7 @@ describe('In autoload/shada.vim', function()
' + n name \'@\'',
' + rc contents ["abc", "def"]',
' + rt type CHARACTERWISE',
+ ' + ru is_unnamed FALSE',
' + rw block width 10',
' + sb search backward TRUE',
' + sc smartcase value FALSE',
@@ -204,6 +205,7 @@ describe('In autoload/shada.vim', function()
'rt': 0,
'rw': 10,
'rc': ['abc', 'def'],
+ 'ru': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'n': 0x40,
'l': 10,
'c': 0,
@@ -226,6 +228,8 @@ describe('In autoload/shada.vim', function()
.. '0 (CHARACTERWISE), 1 (LINEWISE), 2 (BLOCKWISE)',
' + rt type 10',
' # Expected boolean',
+ ' + ru is_unnamed 10',
+ ' # Expected boolean',
' + sc smartcase value NIL',
' # Expected boolean',
' + sm magic value "TRUE"',
@@ -240,6 +244,7 @@ describe('In autoload/shada.vim', function()
'sp': {'_TYPE': v:msgpack_types.string, '_VAL': ["abc"]},
'rt': 10,
'rc': '10',
+ 'ru': 10,
'n': -0x40,
'l': -10,
'c': 'abc',
@@ -720,12 +725,14 @@ describe('In autoload/shada.vim', function()
' # Expected integer',
' + rw block width ""',
' + rt type BLOCKWISE',
- ' + ru is_unnamed FALSE',
+ ' # Expected boolean',
+ ' + ru is_unnamed ""',
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
'n': 0x20,
'rc': ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],
'rw': "",
'rt': 2,
+ 'ru': ""
}}] ]]):gsub('\n', ''))
sd2strings_eq({
'Register with timestamp ' .. epoch .. ':',
@@ -738,12 +745,14 @@ describe('In autoload/shada.vim', function()
' # Unexpected enum value: expected one of 0 (CHARACTERWISE), '
.. '1 (LINEWISE), 2 (BLOCKWISE)',
' + rt type 10',
- ' + ru is_unnamed FALSE',
+ ' # Expected boolean',
+ ' + ru is_unnamed ["abc", "def"]',
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
'n': 0x20,
'rc': 0,
'rw': -1,
'rt': 10,
+ 'ru': ['abc', 'def'],
}}] ]]):gsub('\n', ''))
sd2strings_eq({
'Register with timestamp ' .. epoch .. ':',
diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua
index 256242cbf6..71af14aba8 100644
--- a/test/functional/shada/registers_spec.lua
+++ b/test/functional/shada/registers_spec.lua
@@ -148,6 +148,19 @@ describe('ShaDa support code', function()
eq({{'\171«'}, 'v'}, getreg('e'))
end)
+ it('has a blank unnamed register if it wasn\'t set and register 0 is empty',
+ function()
+ setreg('1', {'one'}, 'c')
+ setreg('2', {'two'}, 'c')
+ setreg('a', {'a'}, 'c')
+ nvim_command('qall')
+ reset()
+ eq({{}, ''}, getreg('0'))
+ eq({{'one'}, 'v'}, getreg('1'))
+ eq({{}, ''}, getreg('"'))
+ eq({{'a'}, 'v'}, getreg('a'))
+ end)
+
it('defaults the unnamed register to register 0 if it wasn\'t set',
function()
setreg('0', {'zero'}, 'c')