blob: 011c9ae39da6e42da3b5e9595ca91a1b6ba4004b [file] [log] [blame]
Bram Moolenaar06a89a52006-04-29 22:01:03 +00001Tests for string and html text objects. vim: set ft=vim :
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00002
Bram Moolenaar89cb5e02004-07-19 20:55:54 +00003Note that the end-of-line moves the cursor to the next test line.
4
5Also test match() and matchstr()
6
Bram Moolenaar9feaf622014-02-22 22:18:47 +01007Also test the gn command and repeating it.
8
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00009STARTTEST
10:so small.vim
11/^start:/
12da"
130va'a'rx
1402f`da`
150fXdi"
1603f'vi'ry
17:set quoteescape=+*-
18di`
19$F"va"oha"i"rz
Bram Moolenaar06a89a52006-04-29 22:01:03 +000020:"
21/^<begin
22jfXdit
230fXdit
24fXdat
250fXdat
26:"
27:put =matchstr(\"abcd\", \".\", 0, 2) " b
Bram Moolenaar89cb5e02004-07-19 20:55:54 +000028:put =matchstr(\"abcd\", \"..\", 0, 2) " bc
29:put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match)
30:put =matchstr(\"abcd\", \".\", 0, -1) " a
31:put =match(\"abcd\", \".\", 0, 5) " -1
32:put =match(\"abcd\", \".\", 0, -1) " 0
Bram Moolenaar9feaf622014-02-22 22:18:47 +010033:put =match('abc', '.', 0, 1) " 0
34:put =match('abc', '.', 0, 2) " 1
35:put =match('abc', '.', 0, 3) " 2
36:put =match('abc', '.', 0, 4) " -1
37:put =match('abc', '.', 1, 1) " 1
38:put =match('abc', '.', 2, 1) " 2
39:put =match('abc', '.', 3, 1) " -1
40:put =match('abc', '$', 0, 1) " 3
41:put =match('abc', '$', 0, 2) " -1
42:put =match('abc', '$', 1, 1) " 3
43:put =match('abc', '$', 2, 1) " 3
44:put =match('abc', '$', 3, 1) " 3
45:put =match('abc', '$', 4, 1) " -1
46:put =match('abc', '\zs', 0, 1) " 0
47:put =match('abc', '\zs', 0, 2) " 1
48:put =match('abc', '\zs', 0, 3) " 2
49:put =match('abc', '\zs', 0, 4) " 3
50:put =match('abc', '\zs', 0, 5) " -1
51:put =match('abc', '\zs', 1, 1) " 1
52:put =match('abc', '\zs', 2, 1) " 2
53:put =match('abc', '\zs', 3, 1) " 3
54:put =match('abc', '\zs', 4, 1) " -1
Bram Moolenaar641e2862012-07-25 15:06:34 +020055/^foobar
56gncsearchmatch/one\_s*two\_s
57:1
58gnd
59/[a]bcdx
60:1
Bram Moolenaardd7d8462012-08-29 16:55:13 +0200612gnd/join
62/$
630gnd
64/\>\zs
650gnd/^
66gnd$h/\zs
Bram Moolenaar57c0ea82012-09-05 12:16:45 +020067gnd/[u]niquepattern/s
68vlgnd
Bram Moolenaar0c178752012-10-11 03:35:45 +020069/mother
70:set selection=exclusive
Bram Moolenaare78495d2013-06-30 14:46:53 +020071$cgNmongoose/i
72cgnj
Bram Moolenaar4c7cb6b2013-10-02 21:55:02 +020073:" Make sure there is no other match y uppercase.
74/x59
75gggnd
Bram Moolenaar9feaf622014-02-22 22:18:47 +010076:" test repeating dgn
77/^Johnny
78ggdgn.
79:" test repeating gUgn
80/^Depp
81gggUgn.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000082:/^start:/,/^end:/wq! test.out
83ENDTEST
84
85start: "wo\"rd\\" foo
86'foo' 'bar' 'piep'
87bla bla `quote` blah
88out " in "noXno"
89"'" 'blah' rep 'buh'
90bla `s*`d-`+++`l**` b`la
91voo "nah" sdf " asdf" sdf " sdf" sd
Bram Moolenaar06a89a52006-04-29 22:01:03 +000092
93<begin>
94-<b>asdf<i>Xasdf</i>asdf</b>-
95-<b>asdX<i>a<i />sdf</i>asdf</b>-
96-<b>asdf<i>Xasdf</i>asdf</b>-
97-<b>asdX<i>as<b />df</i>asdf</b>-
98</begin>
Bram Moolenaar641e2862012-07-25 15:06:34 +020099SEARCH:
100foobar
101one
102two
103abcdx | abcdx | abcdx
Bram Moolenaardd7d8462012-08-29 16:55:13 +0200104join
105lines
106zero width pattern
107delete first and last chars
Bram Moolenaar57c0ea82012-09-05 12:16:45 +0200108uniquepattern uniquepattern
Bram Moolenaar0c178752012-10-11 03:35:45 +0200109my very excellent mother just served us nachos
Bram Moolenaare78495d2013-06-30 14:46:53 +0200110for (i=0; i<=10; i++)
Bram Moolenaar4c7cb6b2013-10-02 21:55:02 +0200111Y
112text
113Y
Bram Moolenaar9feaf622014-02-22 22:18:47 +0100114--1
115Johnny
116--2
117Johnny
118--3
119Depp
120--4
121Depp
122--5
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000123end: