xref: /vim-8.2.3635/src/testdir/test_join.vim (revision b1c9198a)
1" Test for joining lines.
2
3func Test_join_with_count()
4  new
5  call setline(1, ['one', 'two', 'three', 'four'])
6  normal J
7  call assert_equal('one two', getline(1))
8  %del
9  call setline(1, ['one', 'two', 'three', 'four'])
10  normal 10J
11  call assert_equal('one two three four', getline(1))
12  quit!
13endfunc
14
15" Tests for setting the '[,'] marks when joining lines.
16func Test_join_marks()
17  enew
18  call append(0, [
19	      \ "\t\tO sodales, ludite, vos qui",
20	      \ "attamen consulite per voster honur. Tua pulchra " .
21	      \ "facies me fay planszer milies",
22	      \ "",
23	      \ "This line.",
24	      \ "Should be joined with the next line",
25	      \ "and with this line"])
26
27  normal gg0gqj
28  call assert_equal([0, 1, 1, 0], getpos("'["))
29  call assert_equal([0, 2, 1, 0], getpos("']"))
30
31  /^This line/;'}-join
32  call assert_equal([0, 4, 11, 0], getpos("'["))
33  call assert_equal([0, 4, 67, 0], getpos("']"))
34  enew!
35endfunc
36