summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_diffmode.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-29 13:56:33 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-29 13:56:33 +0100
commitae7dba896975051a3f0b7123faa08dac5635972d (patch)
tree4535b38de33959b00eccc8a18194fe6e83d3f353 /src/testdir/test_diffmode.vim
parente20e68b40d9572393bb3577d6a0b52e960950b57 (diff)
patch 8.2.0054: :diffget and :diffput don't have good completionv8.2.0054
Problem: :diffget and :diffput don't have good completion. Solution: Add proper completion. (Dominique Pelle, closes #5409)
Diffstat (limited to 'src/testdir/test_diffmode.vim')
-rw-r--r--src/testdir/test_diffmode.vim40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 9dfe2fefce..b93cc6d3e1 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -242,6 +242,46 @@ func Test_diffput_two()
bwipe! b
endfunc
+func Test_diffget_diffput_completion()
+ new Xdiff1 | diffthis
+ new Xdiff2 | diffthis
+ new Xdiff3 | diffthis
+ new Xdiff4
+
+ " :diffput and :diffget completes names of buffers which
+ " are in diff mode and which are different then current buffer.
+ b Xdiff1
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput Xdiff2 Xdiff3', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget Xdiff2 Xdiff3', @:)
+ call assert_equal(['Xdiff2', 'Xdiff3'], getcompletion('', 'diff_buffer'))
+
+ b Xdiff2
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput Xdiff1 Xdiff3', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget Xdiff1 Xdiff3', @:)
+ call assert_equal(['Xdiff1', 'Xdiff3'], getcompletion('', 'diff_buffer'))
+
+ b Xdiff3
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput Xdiff1 Xdiff2', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget Xdiff1 Xdiff2', @:)
+ call assert_equal(['Xdiff1', 'Xdiff2'], getcompletion('', 'diff_buffer'))
+
+ " No completion when in Xdiff4, it's not in diff mode.
+ b Xdiff4
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput ', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget ', @:)
+ call assert_equal([], getcompletion('', 'diff_buffer'))
+
+ %bwipe
+endfunc
+
func Test_dp_do_buffer()
e! one
let bn1=bufnr('%')