aboutsummaryrefslogtreecommitdiff
path: root/test/functional/shada
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/functional/shada
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/functional/shada')
-rw-r--r--test/functional/shada/errors_spec.lua5
-rw-r--r--test/functional/shada/history_spec.lua22
2 files changed, 25 insertions, 2 deletions
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()