mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
eval/shada: Add testing for unnamed register with setreg and startup
This commit is contained in:
parent
9a91ce4fa6
commit
beca4dc16c
@ -516,6 +516,15 @@ describe('eval', function()
|
||||
eq({'item'}, eval("y"))
|
||||
end)
|
||||
|
||||
it('sets the unnamed register when the "u" option is passed to setreg', function()
|
||||
execute("call setreg('a','a reg', 'cu')")
|
||||
eq("a reg", eval('@"'))
|
||||
execute("call setreg('b','b reg', 'cu')")
|
||||
eq("b reg", eval('@"'))
|
||||
execute("call setreg('c','c reg', 'c')")
|
||||
eq("b reg", eval('@"'))
|
||||
end)
|
||||
|
||||
it('search and expressions', function()
|
||||
command('so test_eval_setup.vim')
|
||||
command([=[call SetReg('/', ['abc/'])]=])
|
||||
|
@ -636,6 +636,7 @@ describe('In autoload/shada.vim', function()
|
||||
' # Required key missing: rc',
|
||||
' + rw block width 0',
|
||||
' + rt type CHARACTERWISE',
|
||||
' + ru is_unnamed FALSE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
}}] ]]):gsub('\n', ''))
|
||||
sd2strings_eq({
|
||||
@ -645,6 +646,7 @@ describe('In autoload/shada.vim', function()
|
||||
' # Required key missing: rc',
|
||||
' + rw block width 0',
|
||||
' + rt type CHARACTERWISE',
|
||||
' + ru is_unnamed FALSE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
}}] ]]):gsub('\n', ''))
|
||||
@ -655,9 +657,11 @@ describe('In autoload/shada.vim', function()
|
||||
' + rc contents ["abc", "def"]',
|
||||
' + rw block width 0',
|
||||
' + rt type CHARACTERWISE',
|
||||
' + ru is_unnamed FALSE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': ["abc", "def"],
|
||||
'ru': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
|
||||
}}] ]]):gsub('\n', ''))
|
||||
sd2strings_eq({
|
||||
'Register with timestamp ' .. epoch .. ':',
|
||||
@ -668,9 +672,11 @@ describe('In autoload/shada.vim', function()
|
||||
' | - "abcdefghijklmnopqrstuvwxyz"',
|
||||
' + rw block width 0',
|
||||
' + rt type CHARACTERWISE',
|
||||
' + ru is_unnamed TRUE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],
|
||||
'ru': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
|
||||
}}] ]]):gsub('\n', ''))
|
||||
sd2strings_eq({
|
||||
'Register with timestamp ' .. epoch .. ':',
|
||||
@ -681,6 +687,7 @@ describe('In autoload/shada.vim', function()
|
||||
' | - "abcdefghijklmnopqrstuvwxyz"',
|
||||
' + rw block width 0',
|
||||
' + rt type CHARACTERWISE',
|
||||
' + ru is_unnamed FALSE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],
|
||||
@ -696,6 +703,7 @@ describe('In autoload/shada.vim', function()
|
||||
' | - "abcdefghijklmnopqrstuvwxyz"',
|
||||
' + rw block width 5',
|
||||
' + rt type LINEWISE',
|
||||
' + ru is_unnamed FALSE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],
|
||||
@ -712,6 +720,7 @@ describe('In autoload/shada.vim', function()
|
||||
' # Expected integer',
|
||||
' + rw block width ""',
|
||||
' + rt type BLOCKWISE',
|
||||
' + ru is_unnamed FALSE',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],
|
||||
@ -729,12 +738,31 @@ 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',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': 0,
|
||||
'rw': -1,
|
||||
'rt': 10,
|
||||
}}] ]]):gsub('\n', ''))
|
||||
sd2strings_eq({
|
||||
'Register with timestamp ' .. epoch .. ':',
|
||||
' % Key Description Value',
|
||||
' + n name \' \'',
|
||||
' + rc contents @',
|
||||
' | - "abcdefghijklmnopqrstuvwxyz"',
|
||||
' | - "abcdefghijklmnopqrstuvwxyz"',
|
||||
' + rw block width 5',
|
||||
' + rt type LINEWISE',
|
||||
' # Expected boolean',
|
||||
' + ru is_unnamed 0',
|
||||
}, ([[ [{'type': 5, 'timestamp': 0, 'data': {
|
||||
'n': 0x20,
|
||||
'rc': ['abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'],
|
||||
'rw': 5,
|
||||
'rt': 1,
|
||||
'ru': 0,
|
||||
}}] ]]):gsub('\n', ''))
|
||||
end)
|
||||
|
||||
it('works with variable items', function()
|
||||
|
@ -148,10 +148,23 @@ describe('ShaDa support code', function()
|
||||
eq({{'\171«'}, 'v'}, getreg('e'))
|
||||
end)
|
||||
|
||||
it('remembers which register was the unnamed register when loading',
|
||||
it('defaults the unnamed register to register 0 if it wasn\'t set',
|
||||
function()
|
||||
setreg('0', {'zero'}, 'c')
|
||||
setreg('1', {'one'}, 'c')
|
||||
setreg('2', {'two'}, 'c')
|
||||
nvim_command('qall')
|
||||
reset()
|
||||
eq({{'zero'}, 'v'}, getreg('0'))
|
||||
eq({{'one'}, 'v'}, getreg('1'))
|
||||
eq({{'zero'}, 'v'}, getreg('"'))
|
||||
end)
|
||||
|
||||
it('remembers which register was the unnamed register when loading',
|
||||
function()
|
||||
setreg('0', {'zero'}, 'c')
|
||||
setreg('1', {'one'}, 'cu')
|
||||
setreg('2', {'two'}, 'c')
|
||||
nvim_command('qall')
|
||||
reset()
|
||||
eq({{'zero'}, 'v'}, getreg('0'))
|
||||
|
Loading…
Reference in New Issue
Block a user