blob: 47cf6f562f9c47a96bb3b3a0dc28bf5746373b8e [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 Moolenaarcfbc5ee2004-07-02 15:38:35 +00007STARTTEST
8:so small.vim
9/^start:/
10da"
110va'a'rx
1202f`da`
130fXdi"
1403f'vi'ry
15:set quoteescape=+*-
16di`
17$F"va"oha"i"rz
Bram Moolenaar06a89a52006-04-29 22:01:03 +000018:"
19/^<begin
20jfXdit
210fXdit
22fXdat
230fXdat
24:"
25:put =matchstr(\"abcd\", \".\", 0, 2) " b
Bram Moolenaar89cb5e02004-07-19 20:55:54 +000026:put =matchstr(\"abcd\", \"..\", 0, 2) " bc
27:put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match)
28:put =matchstr(\"abcd\", \".\", 0, -1) " a
29:put =match(\"abcd\", \".\", 0, 5) " -1
30:put =match(\"abcd\", \".\", 0, -1) " 0
Bram Moolenaar641e2862012-07-25 15:06:34 +020031/^foobar
32gncsearchmatch/one\_s*two\_s
33:1
34gnd
35/[a]bcdx
36:1
Bram Moolenaardd7d8462012-08-29 16:55:13 +0200372gnd/join
38/$
390gnd
40/\>\zs
410gnd/^
42gnd$h/\zs
Bram Moolenaar57c0ea82012-09-05 12:16:45 +020043gnd/[u]niquepattern/s
44vlgnd
Bram Moolenaar0c178752012-10-11 03:35:45 +020045/mother
46:set selection=exclusive
Bram Moolenaare78495d2013-06-30 14:46:53 +020047$cgNmongoose/i
48cgnj
Bram Moolenaar4c7cb6b2013-10-02 21:55:02 +020049:" Make sure there is no other match y uppercase.
50/x59
51gggnd
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000052:/^start:/,/^end:/wq! test.out
53ENDTEST
54
55start: "wo\"rd\\" foo
56'foo' 'bar' 'piep'
57bla bla `quote` blah
58out " in "noXno"
59"'" 'blah' rep 'buh'
60bla `s*`d-`+++`l**` b`la
61voo "nah" sdf " asdf" sdf " sdf" sd
Bram Moolenaar06a89a52006-04-29 22:01:03 +000062
63<begin>
64-<b>asdf<i>Xasdf</i>asdf</b>-
65-<b>asdX<i>a<i />sdf</i>asdf</b>-
66-<b>asdf<i>Xasdf</i>asdf</b>-
67-<b>asdX<i>as<b />df</i>asdf</b>-
68</begin>
Bram Moolenaar641e2862012-07-25 15:06:34 +020069SEARCH:
70foobar
71one
72two
73abcdx | abcdx | abcdx
Bram Moolenaardd7d8462012-08-29 16:55:13 +020074join
75lines
76zero width pattern
77delete first and last chars
Bram Moolenaar57c0ea82012-09-05 12:16:45 +020078uniquepattern uniquepattern
Bram Moolenaar0c178752012-10-11 03:35:45 +020079my very excellent mother just served us nachos
Bram Moolenaare78495d2013-06-30 14:46:53 +020080for (i=0; i<=10; i++)
Bram Moolenaar4c7cb6b2013-10-02 21:55:02 +020081Y
82text
83Y
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000084end: