Mercurial > vim
annotate src/testdir/test_substitute.vim @ 10910:8bff367672a4 v8.0.0344
patch 8.0.0344: unlet command leaks memory
commit https://github.com/vim/vim/commit/49439c4cdf7d2822255f292adda4226656fe144d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 20 23:07:05 2017 +0100
patch 8.0.0344: unlet command leaks memory
Problem: Unlet command leaks memory. (Nikolai Pavlov)
Solution: Free the memory on error. (closes https://github.com/vim/vim/issues/1497)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 20 Feb 2017 23:15:04 +0100 |
parents | fbed07965b6a |
children | ab9f7bbe4439 |
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 |
10893
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
42 |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
43 function! Test_substitute_variants() |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
44 " Validate that all the 2-/3-letter variants which embed the flags into the |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
45 " command name actually work. |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
46 enew! |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
47 let ln = 'Testing string' |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
48 let variants = [ |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
49 \ { 'cmd': ':s/Test/test/c', 'exp': 'testing string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
50 \ { 'cmd': ':s/foo/bar/ce', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
51 \ { 'cmd': ':s/t/r/cg', 'exp': 'Tesring srring', 'prompt': 'a' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
52 \ { 'cmd': ':s/t/r/ci', 'exp': 'resting string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
53 \ { 'cmd': ':s/t/r/cI', 'exp': 'Tesring string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
54 \ { 'cmd': ':s/t/r/cn', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
55 \ { 'cmd': ':s/t/r/cp', 'exp': 'Tesring string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
56 \ { 'cmd': ':s/t/r/cl', 'exp': 'Tesring string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
57 \ { 'cmd': ':s/t/r/gc', 'exp': 'Tesring srring', 'prompt': 'a' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
58 \ { 'cmd': ':s/foo/bar/ge', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
59 \ { 'cmd': ':s/t/r/g', 'exp': 'Tesring srring' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
60 \ { 'cmd': ':s/t/r/gi', 'exp': 'resring srring' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
61 \ { 'cmd': ':s/t/r/gI', 'exp': 'Tesring srring' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
62 \ { 'cmd': ':s/t/r/gn', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
63 \ { 'cmd': ':s/t/r/gp', 'exp': 'Tesring srring' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
64 \ { 'cmd': ':s/t/r/gl', 'exp': 'Tesring srring' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
65 \ { 'cmd': ':s//r/gr', 'exp': 'Testr strr' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
66 \ { 'cmd': ':s/t/r/ic', 'exp': 'resting string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
67 \ { 'cmd': ':s/foo/bar/ie', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
68 \ { 'cmd': ':s/t/r/i', 'exp': 'resting string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
69 \ { 'cmd': ':s/t/r/iI', 'exp': 'Tesring string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
70 \ { 'cmd': ':s/t/r/in', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
71 \ { 'cmd': ':s/t/r/ip', 'exp': 'resting string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
72 \ { 'cmd': ':s//r/ir', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
73 \ { 'cmd': ':s/t/r/Ic', 'exp': 'Tesring string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
74 \ { 'cmd': ':s/foo/bar/Ie', 'exp': ln }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
75 \ { 'cmd': ':s/t/r/Ig', 'exp': 'Tesring srring' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
76 \ { 'cmd': ':s/t/r/Ii', 'exp': 'resting string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
77 \ { 'cmd': ':s/t/r/I', 'exp': 'Tesring string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
78 \ { 'cmd': ':s/t/r/Ip', 'exp': 'Tesring string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
79 \ { 'cmd': ':s/t/r/Il', 'exp': 'Tesring string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
80 \ { 'cmd': ':s//r/Ir', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
81 \ { 'cmd': ':s//r/rc', 'exp': 'Testr string', 'prompt': 'y' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
82 \ { 'cmd': ':s//r/rg', 'exp': 'Testr strr' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
83 \ { 'cmd': ':s//r/ri', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
84 \ { 'cmd': ':s//r/rI', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
85 \ { 'cmd': ':s//r/rn', 'exp': 'Testing string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
86 \ { 'cmd': ':s//r/rp', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
87 \ { 'cmd': ':s//r/rl', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
88 \ { 'cmd': ':s//r/r', 'exp': 'Testr string' }, |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
89 \] |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
90 |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
91 for var in variants |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
92 for run in [1, 2] |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
93 let cmd = var.cmd |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
94 if run == 2 && cmd =~ "/.*/.*/." |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
95 " Change :s/from/to/{flags} to :s{flags} |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
96 let cmd = substitute(cmd, '/.*/', '', '') |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
97 endif |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
98 call setline(1, [ln]) |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
99 let msg = printf('using "%s"', cmd) |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
100 let @/='ing' |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
101 let v:errmsg = '' |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
102 call feedkeys(cmd . "\<CR>" . get(var, 'prompt', ''), 'ntx') |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
103 " No error should exist (matters for testing e flag) |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
104 call assert_equal('', v:errmsg, msg) |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
105 call assert_equal(var.exp, getline('.'), msg) |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
106 endfor |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
107 endfor |
fbed07965b6a
patch 8.0.0336: flags of :substitute not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
108 endfunction |