853
|
1 Tests for string and html text objects. vim: set ft=vim :
|
12
|
2
|
19
|
3 Note that the end-of-line moves the cursor to the next test line.
|
|
4
|
|
5 Also test match() and matchstr()
|
|
6
|
12
|
7 STARTTEST
|
|
8 :so small.vim
|
|
9 /^start:/
|
|
10 da"
|
|
11 0va'a'rx
|
|
12 02f`da`
|
|
13 0fXdi"
|
|
14 03f'vi'ry
|
|
15 :set quoteescape=+*-
|
|
16 di`
|
|
17 $F"va"oha"i"rz
|
853
|
18 :"
|
|
19 /^<begin
|
|
20 jfXdit
|
|
21 0fXdit
|
|
22 fXdat
|
|
23 0fXdat
|
6661
|
24 dit
|
853
|
25 :"
|
|
26 :put =matchstr(\"abcd\", \".\", 0, 2) " b
|
19
|
27 :put =matchstr(\"abcd\", \"..\", 0, 2) " bc
|
|
28 :put =matchstr(\"abcd\", \".\", 2, 0) " c (zero and negative -> first match)
|
|
29 :put =matchstr(\"abcd\", \".\", 0, -1) " a
|
|
30 :put =match(\"abcd\", \".\", 0, 5) " -1
|
|
31 :put =match(\"abcd\", \".\", 0, -1) " 0
|
5676
|
32 :put =match('abc', '.', 0, 1) " 0
|
|
33 :put =match('abc', '.', 0, 2) " 1
|
|
34 :put =match('abc', '.', 0, 3) " 2
|
|
35 :put =match('abc', '.', 0, 4) " -1
|
|
36 :put =match('abc', '.', 1, 1) " 1
|
|
37 :put =match('abc', '.', 2, 1) " 2
|
|
38 :put =match('abc', '.', 3, 1) " -1
|
|
39 :put =match('abc', '$', 0, 1) " 3
|
|
40 :put =match('abc', '$', 0, 2) " -1
|
|
41 :put =match('abc', '$', 1, 1) " 3
|
|
42 :put =match('abc', '$', 2, 1) " 3
|
|
43 :put =match('abc', '$', 3, 1) " 3
|
|
44 :put =match('abc', '$', 4, 1) " -1
|
|
45 :put =match('abc', '\zs', 0, 1) " 0
|
|
46 :put =match('abc', '\zs', 0, 2) " 1
|
|
47 :put =match('abc', '\zs', 0, 3) " 2
|
|
48 :put =match('abc', '\zs', 0, 4) " 3
|
|
49 :put =match('abc', '\zs', 0, 5) " -1
|
|
50 :put =match('abc', '\zs', 1, 1) " 1
|
|
51 :put =match('abc', '\zs', 2, 1) " 2
|
|
52 :put =match('abc', '\zs', 3, 1) " 3
|
|
53 :put =match('abc', '\zs', 4, 1) " -1
|
12
|
54 :/^start:/,/^end:/wq! test.out
|
|
55 ENDTEST
|
|
56
|
|
57 start: "wo\"rd\\" foo
|
|
58 'foo' 'bar' 'piep'
|
|
59 bla bla `quote` blah
|
|
60 out " in "noXno"
|
|
61 "'" 'blah' rep 'buh'
|
|
62 bla `s*`d-`+++`l**` b`la
|
|
63 voo "nah" sdf " asdf" sdf " sdf" sd
|
853
|
64
|
|
65 <begin>
|
|
66 -<b>asdf<i>Xasdf</i>asdf</b>-
|
|
67 -<b>asdX<i>a<i />sdf</i>asdf</b>-
|
|
68 -<b>asdf<i>Xasdf</i>asdf</b>-
|
|
69 -<b>asdX<i>as<b />df</i>asdf</b>-
|
6661
|
70 -<b>
|
|
71 innertext object
|
|
72 </b>
|
853
|
73 </begin>
|
3701
|
74 SEARCH:
|
12
|
75 end:
|