aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorAbdelhakeem Osama <abdelhakeem.osama@hotmail.com>2019-04-02 00:50:28 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-04-02 00:50:28 +0200
commit35362495c965554f45634bcde3c4ce6d5eca52aa (patch)
treea5ab5056c94fec9e1585f33840b3c79a3209f204 /test/functional
parenta011f8a3211cfc3369437d8686c6999d491ba290 (diff)
downloadrneovim-35362495c965554f45634bcde3c4ce6d5eca52aa.tar.gz
rneovim-35362495c965554f45634bcde3c4ce6d5eca52aa.tar.bz2
rneovim-35362495c965554f45634bcde3c4ce6d5eca52aa.zip
jumplist: avoid extra tail entry #9805
fixes #9775
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/normal/jump_spec.lua48
-rw-r--r--test/functional/shada/marks_spec.lua6
-rw-r--r--test/functional/shada/merging_spec.lua11
3 files changed, 56 insertions, 9 deletions
diff --git a/test/functional/normal/jump_spec.lua b/test/functional/normal/jump_spec.lua
new file mode 100644
index 0000000000..5bed541752
--- /dev/null
+++ b/test/functional/normal/jump_spec.lua
@@ -0,0 +1,48 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local clear = helpers.clear
+local command = helpers.command
+local eq = helpers.eq
+local funcs = helpers.funcs
+local feed = helpers.feed
+local write_file = helpers.write_file
+
+describe('jumplist', function()
+ local fname1 = 'Xtest-functional-normal-jump'
+ local fname2 = fname1..'2'
+ before_each(clear)
+ after_each(function()
+ os.remove(fname1)
+ os.remove(fname2)
+ end)
+
+ it('does not add a new entry on startup', function()
+ eq('\n jump line col file/text\n>', funcs.execute('jumps'))
+ end)
+
+ it('does not require two <C-O> strokes to jump back', function()
+ write_file(fname1, 'first file contents')
+ write_file(fname2, 'second file contents')
+
+ command('args '..fname1..' '..fname2)
+ local buf1 = funcs.bufnr(fname1)
+ local buf2 = funcs.bufnr(fname2)
+
+ command('next')
+ feed('<C-O>')
+ eq(buf1, funcs.bufnr('%'))
+
+ command('first')
+ command('snext')
+ feed('<C-O>')
+ eq(buf1, funcs.bufnr('%'))
+ feed('<C-I>')
+ eq(buf2, funcs.bufnr('%'))
+ feed('<C-O>')
+ eq(buf1, funcs.bufnr('%'))
+
+ command('drop '..fname2)
+ feed('<C-O>')
+ eq(buf1, funcs.bufnr('%'))
+ end)
+end)
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua
index c2f6351e00..e6450e68b3 100644
--- a/test/functional/shada/marks_spec.lua
+++ b/test/functional/shada/marks_spec.lua
@@ -189,9 +189,6 @@ describe('ShaDa support code', function()
eq(1, nvim_current_line())
nvim_command('execute "normal! \\<C-o>"')
eq(testfilename, funcs.bufname('%'))
- eq(1, nvim_current_line())
- nvim_command('execute "normal! \\<C-o>"')
- eq(testfilename, funcs.bufname('%'))
eq(2, nvim_current_line())
nvim_command('execute "normal! \\<C-o>"')
eq(testfilename_2, funcs.bufname('%'))
@@ -199,6 +196,9 @@ describe('ShaDa support code', function()
nvim_command('execute "normal! \\<C-o>"')
eq(testfilename_2, funcs.bufname('%'))
eq(2, nvim_current_line())
+ nvim_command('execute "normal! \\<C-o>"')
+ eq(testfilename_2, funcs.bufname('%'))
+ eq(2, nvim_current_line())
end)
it('is able to dump and restore change list', function()
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua
index a628baff53..22f2b8348d 100644
--- a/test/functional/shada/merging_spec.lua
+++ b/test/functional/shada/merging_spec.lua
@@ -912,12 +912,11 @@ describe('ShaDa jumps support code', function()
eq('', curbufmeths.get_name())
eq('\n'
.. ' jump line col file/text\n'
- .. ' 6 2 0 ' .. mock_file_path .. 'c\n'
- .. ' 5 2 0 ' .. mock_file_path .. 'd\n'
- .. ' 4 3 0 ' .. mock_file_path .. 'd\n'
- .. ' 3 2 0 ' .. mock_file_path .. 'e\n'
- .. ' 2 2 0 ' .. mock_file_path .. 'f\n'
- .. ' 1 1 0 \n'
+ .. ' 5 2 0 ' .. mock_file_path .. 'c\n'
+ .. ' 4 2 0 ' .. mock_file_path .. 'd\n'
+ .. ' 3 3 0 ' .. mock_file_path .. 'd\n'
+ .. ' 2 2 0 ' .. mock_file_path .. 'e\n'
+ .. ' 1 2 0 ' .. mock_file_path .. 'f\n'
.. '>', redir_exec('jumps'))
end)