aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFelipe Morales <hel.sheep@gmail.com>2015-11-23 23:03:29 +0100
committerFelipe Morales <hel.sheep@gmail.com>2015-11-23 23:03:29 +0100
commit80cf03602ea68f47c3e70f5193c5c2380940fe45 (patch)
tree58cda1332b1075af5f9ee3cdd7e48b40317ca143 /test
parent369c1fdb259daf4f305ada8744e0564250480398 (diff)
parentb98cea909f1a38fc8d0f901164e1e44b03620e2a (diff)
downloadrneovim-80cf03602ea68f47c3e70f5193c5c2380940fe45.tar.gz
rneovim-80cf03602ea68f47c3e70f5193c5c2380940fe45.tar.bz2
rneovim-80cf03602ea68f47c3e70f5193c5c2380940fe45.zip
Merge pull request #3581 from ZyX-I/fix-shada
Store last search direction when writing ShaDa files
Diffstat (limited to 'test')
-rw-r--r--test/functional/plugin/shada_spec.lua12
-rw-r--r--test/functional/shada/errors_spec.lua5
-rw-r--r--test/functional/shada/history_spec.lua22
3 files changed, 37 insertions, 2 deletions
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index 2202f60ce8..020bb11bbc 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -208,6 +208,7 @@ describe('In autoload/shada.vim', function()
' + rc contents ["abc", "def"]',
' + rt type CHARACTERWISE',
' + rw block width 10',
+ ' + sb search backward TRUE',
' + sc smartcase value FALSE',
' + se place cursor at end TRUE',
' + sh v:hlsearch value TRUE',
@@ -222,6 +223,7 @@ describe('In autoload/shada.vim', function()
'sc': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'sl': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'se': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
+ 'sb': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
'so': 10,
'su': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'ss': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
@@ -307,6 +309,7 @@ describe('In autoload/shada.vim', function()
' + sp pattern "abc"',
' + sh v:hlsearch value FALSE',
' + ss is :s pattern FALSE',
+ ' + sb search backward FALSE',
' + sm magic value TRUE',
' + sc smartcase value FALSE',
' + sl has line offset FALSE',
@@ -322,6 +325,7 @@ describe('In autoload/shada.vim', function()
' + sp pattern "abc"',
' + sh v:hlsearch value FALSE',
' + ss is :s pattern FALSE',
+ ' + sb search backward FALSE',
' + sm magic value TRUE',
' + sc smartcase value FALSE',
' + sl has line offset FALSE',
@@ -343,6 +347,7 @@ describe('In autoload/shada.vim', function()
' + sp pattern "abc"',
' + sh v:hlsearch value FALSE',
' + ss is :s pattern FALSE',
+ ' + sb search backward FALSE',
' + sm magic value TRUE',
' + sc smartcase value FALSE',
' + sl has line offset FALSE',
@@ -353,6 +358,7 @@ describe('In autoload/shada.vim', function()
'sp': 'abc',
'sh': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'ss': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
+ 'sb': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'sm': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
'sc': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'sl': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
@@ -366,6 +372,7 @@ describe('In autoload/shada.vim', function()
' # Required key missing: sp',
' + sh v:hlsearch value FALSE',
' + ss is :s pattern FALSE',
+ ' + sb search backward FALSE',
' + sm magic value TRUE',
' + sc smartcase value FALSE',
' + sl has line offset FALSE',
@@ -380,6 +387,7 @@ describe('In autoload/shada.vim', function()
' + sp pattern ""',
' + sh v:hlsearch value TRUE',
' + ss is :s pattern TRUE',
+ ' + sb search backward TRUE',
' + sm magic value FALSE',
' + sc smartcase value TRUE',
' + sl has line offset TRUE',
@@ -390,6 +398,7 @@ describe('In autoload/shada.vim', function()
'sp': '',
'sh': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
'ss': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
+ 'sb': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
'sm': {'_TYPE': v:msgpack_types.boolean, '_VAL': 0},
'sc': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
'sl': {'_TYPE': v:msgpack_types.boolean, '_VAL': 1},
@@ -407,6 +416,8 @@ describe('In autoload/shada.vim', function()
' # Expected boolean',
' + ss is :s pattern 0',
' # Expected boolean',
+ ' + sb search backward 0',
+ ' # Expected boolean',
' + sm magic value 0',
' # Expected boolean',
' + sc smartcase value 0',
@@ -422,6 +433,7 @@ describe('In autoload/shada.vim', function()
'sp': 0,
'sh': 0,
'ss': 0,
+ 'sb': 0,
'sm': 0,
'sc': 0,
'sl': 0,
diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua
index 16ae77af02..62b9e6c84d 100644
--- a/test/functional/shada/errors_spec.lua
+++ b/test/functional/shada/errors_spec.lua
@@ -124,6 +124,11 @@ describe('ShaDa error handling', function()
eq('Vim(rshada):E575: Error while reading ShaDa file: search pattern entry at position 0 has sc key value which is not a boolean', exc_exec(sdrcmd()))
end)
+ it('fails on search pattern item with NIL search_backward key value', function()
+ wshada('\002\000\009\130\162sX\192\162sb\192')
+ eq('Vim(rshada):E575: Error while reading ShaDa file: search pattern entry at position 0 has sb key value which is not a boolean', exc_exec(sdrcmd()))
+ end)
+
it('fails on search pattern item with NIL has_line_offset key value', function()
wshada('\002\000\009\130\162sX\192\162sl\192')
eq('Vim(rshada):E575: Error while reading ShaDa file: search pattern entry at position 0 has sl key value which is not a boolean', exc_exec(sdrcmd()))
diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua
index 1123f829d2..94513945d0 100644
--- a/test/functional/shada/history_spec.lua
+++ b/test/functional/shada/history_spec.lua
@@ -107,14 +107,32 @@ describe('ShaDa support code', function()
end)
it('dumps and loads last search pattern with offset', function()
- funcs.setline('.', {'foo', 'bar'})
+ meths.set_option('wrapscan', false)
+ funcs.setline('.', {'foo', 'bar--'})
nvim_feed('gg0/a/e+1\n')
eq({0, 2, 3, 0}, funcs.getpos('.'))
nvim_command('wshada')
reset()
- funcs.setline('.', {'foo', 'bar'})
+ meths.set_option('wrapscan', false)
+ funcs.setline('.', {'foo', 'bar--'})
nvim_feed('gg0n')
eq({0, 2, 3, 0}, funcs.getpos('.'))
+ eq(1, meths.get_vvar('searchforward'))
+ end)
+
+ it('dumps and loads last search pattern with offset and backward direction',
+ function()
+ meths.set_option('wrapscan', false)
+ funcs.setline('.', {'foo', 'bar--'})
+ nvim_feed('G$?a?e+1\n')
+ eq({0, 2, 3, 0}, funcs.getpos('.'))
+ nvim_command('wshada')
+ reset()
+ meths.set_option('wrapscan', false)
+ funcs.setline('.', {'foo', 'bar--'})
+ nvim_feed('G$n')
+ eq({0, 2, 3, 0}, funcs.getpos('.'))
+ eq(0, meths.get_vvar('searchforward'))
end)
it('saves v:hlsearch=1', function()