annotate src/testdir/test_diffmode.vim @ 17437:5f71f12bdb8c

Added tag v8.1.1716 for changeset e1b5c15f5fee70aaa68aa8286030cf713a403aee
author Bram Moolenaar <Bram@vim.org>
date Fri, 19 Jul 2019 23:30:05 +0200
parents f178127b7255
children d7708560b77c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for diff mode
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
2 source shared.vim
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
3 source screendump.vim
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_diff_fold_sync()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 enew!
14770
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
7 let g:update_count = 0
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
8 au DiffUpdated * let g:update_count += 1
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
9
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let l = range(50)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let winone = win_getid()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 let l[25] = 'diff'
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let wintwo = win_getid()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " line 15 is inside the closed fold
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal(19, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call win_gotoid(winone)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal(19, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " open the fold
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 normal zv
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal(-1, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " fold in other window must have opened too
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call win_gotoid(wintwo)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal(-1, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " cursor position is in sync
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 normal 23G
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call win_gotoid(winone)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal(23, getcurpos()[1])
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
14770
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
35 call assert_equal(1, g:update_count)
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
36 au! DiffUpdated
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
37
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 windo diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 close!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 set nomodified
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 func Test_vert_split()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
44 set diffopt=filler
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
45 call Common_vert_split()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
46 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
47 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
48
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
49 func Test_vert_split_internal()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
50 set diffopt=internal,filler
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
51 call Common_vert_split()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
52 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
53 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
54
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
55 func Common_vert_split()
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " Disable the title to avoid xterm keeping the wrong one.
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 set notitle noicon
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 let l = ['1 aa', '2 bb', '3 cc', '4 dd', '5 ee']
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 w! Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 normal dd
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 $
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 put
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 normal kkrXoxxx
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 w! Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 file Nop
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 normal ggoyyyjjjozzzz
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 set foldmethod=marker foldcolumn=4
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 vert diffsplit Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 vert diffsplit Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(1, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call assert_equal('diff', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_equal(2, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal(1, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal(1, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal(0, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 let diff_fdm = &fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 let diff_fdc = &fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 " repeat entering diff mode here to see if this saves the wrong settings
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 " jump to second window for a moment to have filler line appear at start of
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 " first window
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 wincmd p
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 call assert_equal(9, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call assert_equal(1, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 call assert_equal(3, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call assert_equal(7, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 " Test diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 diffoff!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 1wincmd 2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 let &diff = 1
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 let &fdm = diff_fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 let &fdc = diff_fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 4wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 diffoff!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 1wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167
9696
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
168 call delete('Xtest')
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
169 call delete('Xtest2')
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 windo bw!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 func Test_filler_lines()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 " Test that diffing shows correct filler lines
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 enew!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 put =range(4,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 vnew
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 put =range(1,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 windo diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 wincmd h
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 call assert_equal(1, line('w0'))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 unlet! diff_fdm diff_fdc
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
185 windo diffoff
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
186 bwipe!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
187 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
188 endfunc
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
190 func Test_diffget_diffput()
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
191 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
192 let l = range(50)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
193 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
194 call assert_fails('diffget', 'E99:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
195 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
196 call assert_fails('diffget', 'E100:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
197 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
198 let l[10] = 'one'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
199 let l[20] = 'two'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
200 let l[30] = 'three'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
201 let l[40] = 'four'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
202 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
203 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
204 call assert_equal('one', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
205 11diffget
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
206 call assert_equal('10', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
207 21diffput
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
208 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
209 call assert_equal('two', getline(21))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
210 normal 31Gdo
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
211 call assert_equal('three', getline(31))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
212 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
213 normal 41Gdp
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
214 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
215 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
216 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
217 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
218 call assert_fails('diffget', 'E101:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
219
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
220 windo diffoff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
221 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
222 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
223
14972
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
224 " Test putting two changes from one buffer to another
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
225 func Test_diffput_two()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
226 new a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
227 let win_a = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
228 call setline(1, range(1, 10))
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
229 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
230 new b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
231 let win_b = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
232 call setline(1, range(1, 10))
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
233 8del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
234 5del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
235 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
236 call win_gotoid(win_a)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
237 %diffput
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
238 call win_gotoid(win_b)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
239 call assert_equal(map(range(1, 10), 'string(v:val)'), getline(1, '$'))
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
240 bwipe! a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
241 bwipe! b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
242 endfunc
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
243
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
244 func Test_dp_do_buffer()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
245 e! one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
246 let bn1=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
247 let l = range(60)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
248 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
249 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
250
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
251 new two
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
252 let l[10] = 'one'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
253 let l[20] = 'two'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
254 let l[30] = 'three'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
255 let l[40] = 'four'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
256 let l[50] = 'five'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
257 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
258 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
259
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
260 " dp and do with invalid buffer number.
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
261 11
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
262 call assert_fails('norm 99999dp', 'E102:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
263 call assert_fails('norm 99999do', 'E102:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
264 call assert_fails('diffput non_existing_buffer', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
265 call assert_fails('diffget non_existing_buffer', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
266
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
267 " dp and do with valid buffer number.
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
268 call assert_equal('one', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
269 exe 'norm ' . bn1 . 'do'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
270 call assert_equal('10', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
271 21
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
272 call assert_equal('two', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
273 diffget one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
274 call assert_equal('20', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
275
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
276 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
277 exe 'norm ' . bn1 . 'dp'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
278 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
279 diffput one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
280 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
281 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
282 call assert_equal('three', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
283 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
284 call assert_equal('four', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
285
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
286 " dp and do with buffer number which is not in diff mode.
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
287 new not_in_diff_mode
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
288 let bn3=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
289 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
290 51
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
291 call assert_fails('exe "norm" . bn3 . "dp"', 'E103:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
292 call assert_fails('exe "norm" . bn3 . "do"', 'E103:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
293 call assert_fails('diffput not_in_diff_mode', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
294 call assert_fails('diffget not_in_diff_mode', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
295
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
296 windo diffoff
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
297 %bwipe!
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 endfunc
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
299
14893
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
300 func Test_do_lastline()
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
301 e! one
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
302 call setline(1, ['1','2','3','4','5','6'])
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
303 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
304
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
305 new two
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
306 call setline(1, ['2','4','5'])
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
307 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
308
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
309 1
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
310 norm dp]c
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
311 norm dp]c
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
312 wincmd w
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
313 call assert_equal(4, line('$'))
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
314 norm G
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
315 norm do
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
316 call assert_equal(3, line('$'))
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
317
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
318 windo diffoff
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
319 %bwipe!
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
320 endfunc
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
321
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
322 func Test_diffoff()
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
323 enew!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
324 call setline(1, ['Two', 'Three'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
325 redraw
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
326 let normattr = screenattr(1, 1)
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
327 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
328 botright vert new
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
329 call setline(1, ['One', '', 'Two', 'Three'])
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
330 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
331 redraw
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
332 call assert_notequal(normattr, screenattr(1, 1))
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
333 diffoff!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
334 redraw
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
335 call assert_equal(normattr, screenattr(1, 1))
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
336 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
337 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
338 endfunc
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
339
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
340 func Common_icase_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
341 edit one
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
342 call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#ve'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
343 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
344 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
345 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
346
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
347 botright vert new two
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
348 call setline(1, ['one', 'TWO', 'Three ', 'Four', 'fI=VE'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
349 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
350
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
351 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
352 call assert_equal(normattr, screenattr(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
353 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
354 call assert_notequal(normattr, screenattr(3, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
355 call assert_equal(normattr, screenattr(4, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
356
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
357 let dtextattr = screenattr(5, 3)
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
358 call assert_notequal(dtextattr, screenattr(5, 1))
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
359 call assert_notequal(dtextattr, screenattr(5, 5))
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
360
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
361 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
362 %bwipe!
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
363 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
364
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
365 func Test_diffopt_icase()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
366 set diffopt=icase,foldcolumn:0
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
367 call Common_icase_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
368 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
369 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
370
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
371 func Test_diffopt_icase_internal()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
372 set diffopt=icase,foldcolumn:0,internal
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
373 call Common_icase_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
374 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
375 endfunc
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
376
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
377 func Common_iwhite_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
378 edit one
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
379 " Difference in trailing spaces and amount of spaces should be ignored,
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
380 " but not other space differences.
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
381 call setline(1, ["One \t", 'Two', 'Three', 'one two', 'one two', 'Four'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
382 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
383 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
384 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
385
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
386 botright vert new two
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
387 call setline(1, ["One\t ", "Two\t ", 'Three', 'one two', 'onetwo', ' Four'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
388 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
389
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
390 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
391 call assert_equal(normattr, screenattr(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
392 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
393 call assert_equal(normattr, screenattr(3, 1))
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
394 call assert_equal(normattr, screenattr(4, 1))
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
395 call assert_notequal(normattr, screenattr(5, 1))
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
396 call assert_notequal(normattr, screenattr(6, 1))
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
397
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
398 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
399 %bwipe!
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
400 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
401
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
402 func Test_diffopt_iwhite()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
403 set diffopt=iwhite,foldcolumn:0
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
404 call Common_iwhite_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
405 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
406 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
407
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
408 func Test_diffopt_iwhite_internal()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
409 set diffopt=internal,iwhite,foldcolumn:0
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
410 call Common_iwhite_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
411 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
412 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
413
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
414 func Test_diffopt_context()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
415 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
416 call setline(1, ['1', '2', '3', '4', '5', '6', '7'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
417 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
418 new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
419 call setline(1, ['1', '2', '3', '4', '5x', '6', '7'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
420 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
421
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
422 set diffopt=context:2
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
423 call assert_equal('+-- 2 lines: 1', foldtextresult(1))
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
424 set diffopt=internal,context:2
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
425 call assert_equal('+-- 2 lines: 1', foldtextresult(1))
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
426
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
427 set diffopt=context:1
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
428 call assert_equal('+-- 3 lines: 1', foldtextresult(1))
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
429 set diffopt=internal,context:1
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
430 call assert_equal('+-- 3 lines: 1', foldtextresult(1))
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
431
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
432 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
433 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
434 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
435 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
436
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
437 func Test_diffopt_horizontal()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
438 set diffopt=internal,horizontal
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
439 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
440
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
441 call assert_equal(&columns, winwidth(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
442 call assert_equal(&columns, winwidth(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
443 call assert_equal(&lines, winheight(1) + winheight(2) + 3)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
444 call assert_inrange(0, 1, winheight(1) - winheight(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
445
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
446 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
447 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
448 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
449 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
450
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
451 func Test_diffopt_vertical()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
452 set diffopt=internal,vertical
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
453 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
454
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
455 call assert_equal(&lines - 2, winheight(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
456 call assert_equal(&lines - 2, winheight(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
457 call assert_equal(&columns, winwidth(1) + winwidth(2) + 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
458 call assert_inrange(0, 1, winwidth(1) - winwidth(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
459
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
460 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
461 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
462 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
463 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
464
12971
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
465 func Test_diffopt_hiddenoff()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
466 set diffopt=internal,filler,foldcolumn:0,hiddenoff
12971
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
467 e! one
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
468 call setline(1, ['Two', 'Three'])
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
469 redraw
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
470 let normattr = screenattr(1, 1)
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
471 diffthis
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
472 botright vert new two
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
473 call setline(1, ['One', 'Four'])
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
474 diffthis
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
475 redraw
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
476 call assert_notequal(normattr, screenattr(1, 1))
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
477 set hidden
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
478 close
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
479 redraw
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
480 " should not diffing with hidden buffer two while 'hiddenoff' is enabled
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
481 call assert_equal(normattr, screenattr(1, 1))
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
482
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
483 bwipe!
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
484 bwipe!
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
485 set hidden& diffopt&
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
486 endfunc
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
487
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
488 func Test_diffoff_hidden()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
489 set diffopt=internal,filler,foldcolumn:0
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
490 e! one
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
491 call setline(1, ['Two', 'Three'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
492 redraw
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
493 let normattr = screenattr(1, 1)
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
494 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
495 botright vert new two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
496 call setline(1, ['One', 'Four'])
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
497 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
498 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
499 call assert_notequal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
500 set hidden
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
501 close
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
502 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
503 " diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
504 call assert_notequal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
505 diffoff
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
506 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
507 call assert_equal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
508 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
509 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
510 " still diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
511 call assert_notequal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
512 diffoff!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
513 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
514 call assert_equal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
515 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
516 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
517 " no longer diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
518 call assert_equal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
519
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
520 bwipe!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
521 bwipe!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
522 set hidden& diffopt&
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
523 endfunc
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
524
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
525 func Test_setting_cursor()
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
526 new Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
527 put =range(1,90)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
528 wq
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
529 new Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
530 put =range(1,100)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
531 wq
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
532
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
533 tabe Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
534 $
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
535 diffsp Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
536 tabclose
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
537
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
538 call delete('Xtest1')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
539 call delete('Xtest2')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
540 endfunc
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
541
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
542 func Test_diff_move_to()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
543 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
544 call setline(1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
545 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
546 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
547 call setline(1, [1, '2x', 3, 4, 4, 5, '6x', 7, '8x', 9, '10x'])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
548 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
549 norm ]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
550 call assert_equal(2, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
551 norm 3]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
552 call assert_equal(9, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
553 norm 10]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
554 call assert_equal(11, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
555 norm [c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
556 call assert_equal(9, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
557 norm 2[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
558 call assert_equal(5, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
559 norm 10[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
560 call assert_equal(2, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
561 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
562 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
563
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
564 func Test_diffexpr()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
565 if !executable('diff')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
566 return
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
567 endif
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
568
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
569 func DiffExpr()
14726
655f00c29c58 patch 8.1.0375: cannot use diff mode with Cygwin diff.exe
Christian Brabandt <cb@256bit.org>
parents: 14696
diff changeset
570 " Prepent some text to check diff type detection
655f00c29c58 patch 8.1.0375: cannot use diff mode with Cygwin diff.exe
Christian Brabandt <cb@256bit.org>
parents: 14696
diff changeset
571 call writefile(['warning', ' message'], v:fname_out)
655f00c29c58 patch 8.1.0375: cannot use diff mode with Cygwin diff.exe
Christian Brabandt <cb@256bit.org>
parents: 14696
diff changeset
572 silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
573 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
574 set diffexpr=DiffExpr()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
575 set diffopt=foldcolumn:0
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
576
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
577 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
578 call setline(1, ['one', 'two', 'three'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
579 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
580 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
581 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
582
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
583 botright vert new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
584 call setline(1, ['one', 'two', 'three.'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
585 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
586
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
587 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
588 call assert_equal(normattr, screenattr(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
589 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
590 call assert_notequal(normattr, screenattr(3, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
591
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
592 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
593 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
594 set diffexpr& diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
595 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
596
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
597 func Test_diffpatch()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
598 " The patch program on MS-Windows may fail or hang.
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
599 if !executable('patch') || !has('unix')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
600 return
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
601 endif
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
602 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
603 insert
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
604 ***************
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
605 *** 1,3 ****
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
606 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
607 ! 2
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
608 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
609 --- 1,4 ----
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
610 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
611 ! 2x
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
612 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
613 + 4
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
614 .
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
615 saveas! Xpatch
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
616 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
617 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
618 call assert_fails('diffpatch Xpatch', 'E816:')
11109
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
619
11113
081ed9efb5c0 patch 8.0.0444: diffpatch fails when the file name has a quote
Christian Brabandt <cb@256bit.org>
parents: 11109
diff changeset
620 for name in ['Xpatch', 'Xpatch$HOME', 'Xpa''tch']
11109
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
621 call setline(1, ['1', '2', '3'])
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
622 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
623 call rename('Xpatch', name)
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
624 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
625 exe 'diffpatch ' . escape(name, '$')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
626 call assert_equal(['1', '2x', '3', '4'], getline(1, '$'))
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
627 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
628 call rename(name, 'Xpatch')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
629 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
630 bwipe!
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
631 endfor
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
632
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
633 call delete('Xpatch')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
634 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
635 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
636
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
637 func Test_diff_too_many_buffers()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
638 for i in range(1, 8)
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
639 exe "new Xtest" . i
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
640 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
641 endfor
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
642 new Xtest9
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
643 call assert_fails('diffthis', 'E96:')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
644 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
645 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
646
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
647 func Test_diff_nomodifiable()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
648 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
649 call setline(1, [1, 2, 3, 4])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
650 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
651 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
652 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
653 call setline(1, ['1x', 2, 3, 3, 4])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
654 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
655 call assert_fails('norm dp', 'E793:')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
656 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
657 call assert_fails('norm do', 'E21:')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
658 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
659 endfunc
11065
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
660
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
661 func Test_diff_hlID()
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
662 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
663 call setline(1, [1, 2, 3])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
664 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
665 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
666 call setline(1, ['1x', 2, 'x', 3])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
667 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
668 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
669
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
670 call assert_equal(synIDattr(diff_hlID(-1, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
671
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
672 call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
673 call assert_equal(synIDattr(diff_hlID(1, 2), "name"), "DiffText")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
674 call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
675 call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "DiffAdd")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
676 call assert_equal(synIDattr(diff_hlID(4, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
677
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
678 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
679 call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
680 call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
681 call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
682
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
683 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
684 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
685
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
686 func Test_diff_filler()
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
687 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
688 call setline(1, [1, 2, 3, 'x', 4])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
689 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
690 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
691 call setline(1, [1, 2, 'y', 'y', 3, 4])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
692 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
693 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
694
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
695 call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)'))
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
696 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
697 call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)'))
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
698
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
699 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
700 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
701
11065
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
702 func Test_diff_lastline()
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
703 enew!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
704 only!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
705 call setline(1, ['This is a ', 'line with five ', 'rows'])
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
706 diffthis
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
707 botright vert new
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
708 call setline(1, ['This is', 'a line with ', 'four rows'])
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
709 diffthis
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
710 1
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
711 call feedkeys("Je a\<CR>", 'tx')
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
712 call feedkeys("Je a\<CR>", 'tx')
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
713 let w1lines = winline()
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
714 wincmd w
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
715 $
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
716 let w2lines = winline()
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
717 call assert_equal(w2lines, w1lines)
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
718 bwipe!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
719 bwipe!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
720 endfunc
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
721
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
722 func WriteDiffFiles(buf, list1, list2)
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
723 call writefile(a:list1, 'Xfile1')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
724 call writefile(a:list2, 'Xfile2')
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
725 if a:buf
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
726 call term_sendkeys(a:buf, ":checktime\<CR>")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
727 endif
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
728 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
729
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
730 " Verify a screendump with both the internal and external diff.
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
731 func VerifyBoth(buf, dumpfile, extra)
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
732 " trailing : for leaving the cursor on the command line
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
733 for cmd in [":set diffopt=filler" . a:extra . "\<CR>:", ":set diffopt+=internal\<CR>:"]
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
734 call term_sendkeys(a:buf, cmd)
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
735 if VerifyScreenDump(a:buf, a:dumpfile, {}, cmd =~ 'internal' ? 'internal' : 'external')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
736 break " don't let the next iteration overwrite the "failed" file.
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
737 endif
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
738 endfor
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
739 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
740
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
741 " Verify a screendump with the internal diff only.
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
742 func VerifyInternal(buf, dumpfile, extra)
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
743 call term_sendkeys(a:buf, ":diffupdate!\<CR>")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
744 " trailing : for leaving the cursor on the command line
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
745 call term_sendkeys(a:buf, ":set diffopt=internal,filler" . a:extra . "\<CR>:")
17385
f178127b7255 patch 8.1.1691: diff test fails on some systems
Bram Moolenaar <Bram@vim.org>
parents: 17270
diff changeset
746 call term_wait(a:buf)
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
747 call VerifyScreenDump(a:buf, a:dumpfile, {})
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
748 endfunc
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
749
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
750 func Test_diff_screen()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
751 if !CanRunVimInTerminal() || !has('menu')
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16137
diff changeset
752 throw 'Skipped: cannot make screendumps and/or menu feature missing'
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
753 endif
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
754 " clean up already existing swap files, just in case
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
755 call delete('.Xfile1.swp')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
756 call delete('.Xfile2.swp')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
757
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
758 " Test 1: Add a line in beginning of file 2
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
759 call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
760 let buf = RunVimInTerminal('-d Xfile1 Xfile2', {})
16135
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
761 " Set autoread mode, so that Vim won't complain once we re-write the test
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
762 " files
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
763 call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
764
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
765 call VerifyBoth(buf, 'Test_diff_01', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
766
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
767 " Test 2: Add a line in beginning of file 1
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
768 call WriteDiffFiles(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
769 call VerifyBoth(buf, 'Test_diff_02', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
770
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
771 " Test 3: Add a line at the end of file 2
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
772 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
773 call VerifyBoth(buf, 'Test_diff_03', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
774
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
775 " Test 4: Add a line at the end of file 1
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
776 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
777 call VerifyBoth(buf, 'Test_diff_04', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
778
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
779 " Test 5: Add a line in the middle of file 2, remove on at the end of file 1
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
780 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
781 call VerifyBoth(buf, 'Test_diff_05', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
782
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
783 " Test 6: Add a line in the middle of file 1, remove on at the end of file 2
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
784 call WriteDiffFiles(buf, [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
785 call VerifyBoth(buf, 'Test_diff_06', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
786
15900
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
787 " Variants on test 6 with different context settings
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
788 call term_sendkeys(buf, ":set diffopt+=context:2\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
789 call VerifyScreenDump(buf, 'Test_diff_06.2', {})
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
790 call term_sendkeys(buf, ":set diffopt-=context:2\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
791 call term_sendkeys(buf, ":set diffopt+=context:1\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
792 call VerifyScreenDump(buf, 'Test_diff_06.1', {})
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
793 call term_sendkeys(buf, ":set diffopt-=context:1\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
794 call term_sendkeys(buf, ":set diffopt+=context:0\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
795 call VerifyScreenDump(buf, 'Test_diff_06.0', {})
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
796 call term_sendkeys(buf, ":set diffopt-=context:0\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
797
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
798 " Test 7 - 9: Test normal/patience/histogram diff algorithm
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
799 call WriteDiffFiles(buf, ['#include <stdio.h>', '', '// Frobs foo heartily', 'int frobnitz(int foo)', '{',
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
800 \ ' int i;', ' for(i = 0; i < 10; i++)', ' {', ' printf("Your answer is: ");',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
801 \ ' printf("%d\n", foo);', ' }', '}', '', 'int fact(int n)', '{', ' if(n > 1)', ' {',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
802 \ ' return fact(n-1) * n;', ' }', ' return 1;', '}', '', 'int main(int argc, char **argv)',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
803 \ '{', ' frobnitz(fact(10));', '}'],
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
804 \ ['#include <stdio.h>', '', 'int fib(int n)', '{', ' if(n > 2)', ' {',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
805 \ ' return fib(n-1) + fib(n-2);', ' }', ' return 1;', '}', '', '// Frobs foo heartily',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
806 \ 'int frobnitz(int foo)', '{', ' int i;', ' for(i = 0; i < 10; i++)', ' {',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
807 \ ' printf("%d\n", foo);', ' }', '}', '',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
808 \ 'int main(int argc, char **argv)', '{', ' frobnitz(fib(10));', '}'])
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
809 call term_sendkeys(buf, ":diffupdate!\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
810 call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
811 call VerifyScreenDump(buf, 'Test_diff_07', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
812
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
813 call term_sendkeys(buf, ":set diffopt+=algorithm:patience\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
814 call VerifyScreenDump(buf, 'Test_diff_08', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
815
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
816 call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
817 call VerifyScreenDump(buf, 'Test_diff_09', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
818
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
819 " Test 10-11: normal/indent-heuristic
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
820 call term_sendkeys(buf, ":set diffopt&vim\<cr>")
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
821 call WriteDiffFiles(buf, ['', ' def finalize(values)', '', ' values.each do |v|', ' v.finalize', ' end'],
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
822 \ ['', ' def finalize(values)', '', ' values.each do |v|', ' v.prepare', ' end', '',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
823 \ ' values.each do |v|', ' v.finalize', ' end'])
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
824 call term_sendkeys(buf, ":diffupdate!\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
825 call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
826 call VerifyScreenDump(buf, 'Test_diff_10', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
827
15103
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
828 " Leave trailing : at commandline!
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
829 call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>:\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
830 call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one')
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
831 " shouldn't matter, if indent-algorithm comes before or after the algorithm
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
832 call term_sendkeys(buf, ":set diffopt&\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
833 call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\<cr>:\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
834 call VerifyScreenDump(buf, 'Test_diff_11', {}, 'two')
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
835 call term_sendkeys(buf, ":set diffopt&\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
836 call term_sendkeys(buf, ":set diffopt+=algorithm:patience,indent-heuristic\<cr>:\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
837 call VerifyScreenDump(buf, 'Test_diff_11', {}, 'three')
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
838
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
839 " Test 12: diff the same file
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
840 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
841 call VerifyBoth(buf, 'Test_diff_12', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
842
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
843 " Test 13: diff an empty file
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
844 call WriteDiffFiles(buf, [], [])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
845 call VerifyBoth(buf, 'Test_diff_13', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
846
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
847 " Test 14: test diffopt+=icase
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
848 call WriteDiffFiles(buf, ['a', 'b', 'cd'], ['A', 'b', 'cDe'])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
849 call VerifyBoth(buf, 'Test_diff_14', " diffopt+=filler diffopt+=icase")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
850
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
851 " Test 15-16: test diffopt+=iwhite
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
852 call WriteDiffFiles(buf, ['int main()', '{', ' printf("Hello, World!");', ' return 0;', '}'],
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
853 \ ['int main()', '{', ' if (0)', ' {', ' printf("Hello, World!");', ' return 0;', ' }', '}'])
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
854 call term_sendkeys(buf, ":diffupdate!\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
855 call term_sendkeys(buf, ":set diffopt&vim diffopt+=filler diffopt+=iwhite\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
856 call VerifyScreenDump(buf, 'Test_diff_15', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
857 call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
858 call VerifyScreenDump(buf, 'Test_diff_16', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
859
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
860 " Test 17: test diffopt+=iblank
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
861 call WriteDiffFiles(buf, ['a', ' ', 'cd', 'ef', 'xxx'], ['a', 'cd', '', 'ef', 'yyy'])
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
862 call VerifyInternal(buf, 'Test_diff_17', " diffopt+=iblank")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
863
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
864 " Test 18: test diffopt+=iblank,iwhite / iwhiteall / iwhiteeol
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
865 call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhite")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
866 call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteall")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
867 call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteeol")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
868
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
869 " Test 19: test diffopt+=iwhiteeol
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
870 call WriteDiffFiles(buf, ['a ', 'x', 'cd', 'ef', 'xx xx', 'foo', 'bar'], ['a', 'x', 'c d', ' ef', 'xx xx', 'foo', '', 'bar'])
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
871 call VerifyInternal(buf, 'Test_diff_19', " diffopt+=iwhiteeol")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
872
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
873 " Test 19: test diffopt+=iwhiteall
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
874 call VerifyInternal(buf, 'Test_diff_20', " diffopt+=iwhiteall")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
875
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
876 " clean up
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
877 call StopVimInTerminal(buf)
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
878 call delete('Xfile1')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
879 call delete('Xfile2')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
880 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
881
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
882 func Test_diff_with_cursorline()
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
883 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16137
diff changeset
884 throw 'Skipped: cannot run Vim in a terminal window'
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
885 endif
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
886
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
887 call writefile([
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
888 \ 'hi CursorLine ctermbg=red ctermfg=white',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
889 \ 'set cursorline',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
890 \ 'call setline(1, ["foo","foo","foo","bar"])',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
891 \ 'vnew',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
892 \ 'call setline(1, ["bee","foo","foo","baz"])',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
893 \ 'windo diffthis',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
894 \ '2wincmd w',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
895 \ ], 'Xtest_diff_cursorline')
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
896 let buf = RunVimInTerminal('-S Xtest_diff_cursorline', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
897
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
898 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_01', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
899 call term_sendkeys(buf, "j")
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
900 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_02', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
901 call term_sendkeys(buf, "j")
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
902 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_03', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
903
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
904 " clean up
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
905 call StopVimInTerminal(buf)
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
906 call delete('Xtest_diff_cursorline')
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
907 endfunc
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
908
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
909 func Test_diff_of_diff()
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
910 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16137
diff changeset
911 throw 'Skipped: cannot run Vim in a terminal window'
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
912 endif
17270
9508c12eec55 patch 8.1.1634: terminal test fails when term_getansicolors() is missing
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
913 if !has("rightleft")
9508c12eec55 patch 8.1.1634: terminal test fails when term_getansicolors() is missing
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
914 throw 'Skipped: rightleft not supported'
9508c12eec55 patch 8.1.1634: terminal test fails when term_getansicolors() is missing
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
915 endif
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
916
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
917 call writefile([
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
918 \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
919 \ 'vnew',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
920 \ 'call setline(1, ["aa","bb","cc"])',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
921 \ 'windo diffthis',
16135
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
922 \ '1wincmd w',
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
923 \ 'setlocal number',
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
924 \ ], 'Xtest_diff_diff')
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
925 let buf = RunVimInTerminal('-S Xtest_diff_diff', {})
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
926
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
927 call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {})
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
928
16137
5a2033905f19 patch 8.1.1073: space in number column is on wrong side with 'rightleft' set
Bram Moolenaar <Bram@vim.org>
parents: 16135
diff changeset
929 call term_sendkeys(buf, ":set rightleft\<cr>")
5a2033905f19 patch 8.1.1073: space in number column is on wrong side with 'rightleft' set
Bram Moolenaar <Bram@vim.org>
parents: 16135
diff changeset
930 call VerifyScreenDump(buf, 'Test_diff_of_diff_02', {})
5a2033905f19 patch 8.1.1073: space in number column is on wrong side with 'rightleft' set
Bram Moolenaar <Bram@vim.org>
parents: 16135
diff changeset
931
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
932 " clean up
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
933 call StopVimInTerminal(buf)
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
934 call delete('Xtest_diff_diff')
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
935 endfunc