blob: 7c35b2e8537e1e61170a2549a1dbfad59b9b957a [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
Bram Moolenaarb6c27352015-03-05 19:57:49 +010026dit
Bram Moolenaar06a89a52006-04-29 22:01:03 +000027:"
28:put =matchstr(\"abcd\", \".\", 0, 2) " b
Bram Moolenaar89cb5e02004-07-19 20:55:54 +000029:put =matchstr(\"abcd\", \"..\", 0, 2) " bc
30:put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match)
31:put =matchstr(\"abcd\", \".\", 0, -1) " a
32:put =match(\"abcd\", \".\", 0, 5) " -1
33:put =match(\"abcd\", \".\", 0, -1) " 0
Bram Moolenaar9feaf622014-02-22 22:18:47 +010034:put =match('abc', '.', 0, 1) " 0
35:put =match('abc', '.', 0, 2) " 1
36:put =match('abc', '.', 0, 3) " 2
37:put =match('abc', '.', 0, 4) " -1
38:put =match('abc', '.', 1, 1) " 1
39:put =match('abc', '.', 2, 1) " 2
40:put =match('abc', '.', 3, 1) " -1
41:put =match('abc', '$', 0, 1) " 3
42:put =match('abc', '$', 0, 2) " -1
43:put =match('abc', '$', 1, 1) " 3
44:put =match('abc', '$', 2, 1) " 3
45:put =match('abc', '$', 3, 1) " 3
46:put =match('abc', '$', 4, 1) " -1
47:put =match('abc', '\zs', 0, 1) " 0
48:put =match('abc', '\zs', 0, 2) " 1
49:put =match('abc', '\zs', 0, 3) " 2
50:put =match('abc', '\zs', 0, 4) " 3
51:put =match('abc', '\zs', 0, 5) " -1
52:put =match('abc', '\zs', 1, 1) " 1
53:put =match('abc', '\zs', 2, 1) " 2
54:put =match('abc', '\zs', 3, 1) " 3
55:put =match('abc', '\zs', 4, 1) " -1
Bram Moolenaar641e2862012-07-25 15:06:34 +020056/^foobar
57gncsearchmatch/one\_s*two\_s
58:1
59gnd
60/[a]bcdx
61:1
Bram Moolenaardd7d8462012-08-29 16:55:13 +0200622gnd/join
63/$
640gnd
65/\>\zs
660gnd/^
67gnd$h/\zs
Bram Moolenaar57c0ea82012-09-05 12:16:45 +020068gnd/[u]niquepattern/s
69vlgnd
Bram Moolenaar0c178752012-10-11 03:35:45 +020070/mother
71:set selection=exclusive
Bram Moolenaare78495d2013-06-30 14:46:53 +020072$cgNmongoose/i
73cgnj
Bram Moolenaar4c7cb6b2013-10-02 21:55:02 +020074:" Make sure there is no other match y uppercase.
75/x59
76gggnd
Bram Moolenaar9feaf622014-02-22 22:18:47 +010077:" test repeating dgn
78/^Johnny
79ggdgn.
80:" test repeating gUgn
81/^Depp
82gggUgn.
Bram Moolenaarb12db9f2014-12-13 22:00:22 +010083gg/a:0\@!\zs\d\+
84nygnop
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000085:/^start:/,/^end:/wq! test.out
86ENDTEST
87
88start: "wo\"rd\\" foo
89'foo' 'bar' 'piep'
90bla bla `quote` blah
91out " in "noXno"
92"'" 'blah' rep 'buh'
93bla `s*`d-`+++`l**` b`la
94voo "nah" sdf " asdf" sdf " sdf" sd
Bram Moolenaar06a89a52006-04-29 22:01:03 +000095
96<begin>
97-<b>asdf<i>Xasdf</i>asdf</b>-
98-<b>asdX<i>a<i />sdf</i>asdf</b>-
99-<b>asdf<i>Xasdf</i>asdf</b>-
100-<b>asdX<i>as<b />df</i>asdf</b>-
Bram Moolenaarb6c27352015-03-05 19:57:49 +0100101-<b>
102innertext object
103</b>
Bram Moolenaar06a89a52006-04-29 22:01:03 +0000104</begin>
Bram Moolenaar641e2862012-07-25 15:06:34 +0200105SEARCH:
106foobar
107one
108two
109abcdx | abcdx | abcdx
Bram Moolenaardd7d8462012-08-29 16:55:13 +0200110join
111lines
112zero width pattern
113delete first and last chars
Bram Moolenaar57c0ea82012-09-05 12:16:45 +0200114uniquepattern uniquepattern
Bram Moolenaar0c178752012-10-11 03:35:45 +0200115my very excellent mother just served us nachos
Bram Moolenaare78495d2013-06-30 14:46:53 +0200116for (i=0; i<=10; i++)
Bram Moolenaarb12db9f2014-12-13 22:00:22 +0100117a:10
118
119a:1
120
121a:20
Bram Moolenaar4c7cb6b2013-10-02 21:55:02 +0200122Y
123text
124Y
Bram Moolenaar9feaf622014-02-22 22:18:47 +0100125--1
126Johnny
127--2
128Johnny
129--3
130Depp
131--4
132Depp
133--5
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000134end: