Bram Moolenaar | 06a89a5 | 2006-04-29 22:01:03 +0000 | [diff] [blame] | 1 | Tests for string and html text objects. vim: set ft=vim : |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 2 | |
Bram Moolenaar | 89cb5e0 | 2004-07-19 20:55:54 +0000 | [diff] [blame] | 3 | Note that the end-of-line moves the cursor to the next test line. |
| 4 | |
| 5 | Also test match() and matchstr() |
| 6 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 06a89a5 | 2006-04-29 22:01:03 +0000 | [diff] [blame] | 18 | :" |
| 19 | /^<begin |
| 20 | jfXdit |
| 21 | 0fXdit |
| 22 | fXdat |
| 23 | 0fXdat |
| 24 | :" |
| 25 | :put =matchstr(\"abcd\", \".\", 0, 2) " b |
Bram Moolenaar | 89cb5e0 | 2004-07-19 20:55:54 +0000 | [diff] [blame] | 26 | :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 Moolenaar | 641e286 | 2012-07-25 15:06:34 +0200 | [diff] [blame] | 31 | /^foobar |
| 32 | gncsearchmatch/one\_s*two\_s |
| 33 | :1 |
| 34 | gnd |
| 35 | /[a]bcdx |
| 36 | :1 |
Bram Moolenaar | dd7d846 | 2012-08-29 16:55:13 +0200 | [diff] [blame^] | 37 | 2gnd/join |
| 38 | /$ |
| 39 | 0gnd |
| 40 | /\>\zs |
| 41 | 0gnd/^ |
| 42 | gnd$h/\zs |
| 43 | gnd |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 44 | :/^start:/,/^end:/wq! test.out |
| 45 | ENDTEST |
| 46 | |
| 47 | start: "wo\"rd\\" foo |
| 48 | 'foo' 'bar' 'piep' |
| 49 | bla bla `quote` blah |
| 50 | out " in "noXno" |
| 51 | "'" 'blah' rep 'buh' |
| 52 | bla `s*`d-`+++`l**` b`la |
| 53 | voo "nah" sdf " asdf" sdf " sdf" sd |
Bram Moolenaar | 06a89a5 | 2006-04-29 22:01:03 +0000 | [diff] [blame] | 54 | |
| 55 | <begin> |
| 56 | -<b>asdf<i>Xasdf</i>asdf</b>- |
| 57 | -<b>asdX<i>a<i />sdf</i>asdf</b>- |
| 58 | -<b>asdf<i>Xasdf</i>asdf</b>- |
| 59 | -<b>asdX<i>as<b />df</i>asdf</b>- |
| 60 | </begin> |
Bram Moolenaar | 641e286 | 2012-07-25 15:06:34 +0200 | [diff] [blame] | 61 | SEARCH: |
| 62 | foobar |
| 63 | one |
| 64 | two |
| 65 | abcdx | abcdx | abcdx |
Bram Moolenaar | dd7d846 | 2012-08-29 16:55:13 +0200 | [diff] [blame^] | 66 | join |
| 67 | lines |
| 68 | zero width pattern |
| 69 | delete first and last chars |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 70 | end: |