annotate src/testdir/test_substitute.vim @ 10072:c104f09ae2f4 v7.4.2307

commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 2 19:50:48 2016 +0200 patch 7.4.2307 Problem: Several tests are old style. Solution: Turn them into new style tests. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Fri, 02 Sep 2016 20:00:09 +0200
parents
children fbed07965b6a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10072
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for multi-line regexps with ":s".
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 function! Test_multiline_subst()
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 enew!
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call append(0, ["1 aa",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 \ "bb",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ "cc",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 \ "2 dd",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 \ "ee",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 \ "3 ef",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 \ "gh",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ "4 ij",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ "5 a8",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 \ "8b c9",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ "9d",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ "6 e7",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ "77f",
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ "xxxxx"])
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 1
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " test if replacing a line break works with a back reference
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 /^1/,/^2/s/\n\(.\)/ \1/
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " test if inserting a line break works with a back reference
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 /^3/,/^4/s/\(.\)$/\r\1/
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " test if replacing a line break with another line break works
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 /^5/,/^6/s/\(\_d\{3}\)/x\1x/
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal('1 aa bb cc 2 dd ee', getline(1))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal('3 e', getline(2))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal('f', getline(3))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal('g', getline(4))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal('h', getline(5))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal('4 i', getline(6))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal('j', getline(7))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal('5 ax8', getline(8))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal('8xb cx9', getline(9))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal('9xd', getline(10))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal('6 ex7', getline(11))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal('7x7f', getline(12))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal('xxxxx', getline(13))
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 enew!
c104f09ae2f4 commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 endfunction