Bram Moolenaar | 745c6eb | 2013-09-19 17:04:30 +0200 | [diff] [blame] | 1 | Tests for regexp with multi-byte encoding and various magic settings. |
| 2 | Test matchstr() with a count and multi-byte chars. |
| 3 | See test44 for exactly the same test with re=1. |
| 4 | |
| 5 | STARTTEST |
| 6 | :so mbyte.vim |
| 7 | :set nocompatible encoding=utf-8 termencoding=latin1 viminfo+=nviminfo |
| 8 | :set re=2 |
| 9 | /^1 |
| 10 | /a*b\{2}c\+/e |
| 11 | x/\Md\*e\{2}f\+/e |
| 12 | x:set nomagic |
| 13 | /g\*h\{2}i\+/e |
| 14 | x/\mj*k\{2}l\+/e |
| 15 | x/\vm*n{2}o+/e |
| 16 | x/\V^aa$ |
| 17 | x:set magic |
| 18 | /\v(a)(b)\2\1\1/e |
| 19 | x/\V[ab]\(\[xy]\)\1 |
| 20 | x:" Now search for multi-byte without composing char |
| 21 | /ม |
| 22 | x:" Now search for multi-byte with composing char |
| 23 | /ม๠|
| 24 | x:" find word by change of word class |
| 25 | /ã¡\<ã«ã¨\>㯠|
| 26 | x:" Test \%u, [\u] and friends |
| 27 | /\%u20ac |
| 28 | x/[\u4f7f\u5929]\+ |
| 29 | x/\%U12345678 |
| 30 | x/[\U1234abcd\u1234\uabcd] |
| 31 | x/\%d21879b |
Bram Moolenaar | 745c6eb | 2013-09-19 17:04:30 +0200 | [diff] [blame] | 32 | x:" Test backwards search from a multi-byte char |
| 33 | /x |
| 34 | x?. |
| 35 | x:let @w=':%s#comb[i]nations#ÅÌá¹£ÌmÌ¥ÌαÌÌÌ#g' |
| 36 | :@w |
Bram Moolenaar | 96c664a | 2015-12-31 16:21:52 +0100 | [diff] [blame] | 37 | :" |
| 38 | :" l Test what 7.3.192 fixed |
| 39 | /^l |
| 40 | :s/ \?/ /g |
Bram Moolenaar | 745c6eb | 2013-09-19 17:04:30 +0200 | [diff] [blame] | 41 | :?^1?,$w! test.out |
| 42 | :e! test.out |
| 43 | G:put =matchstr(\"××××\", \".\", 0, 2) " × |
| 44 | :put =matchstr(\"××××\", \"..\", 0, 2) " ×× |
| 45 | :put =matchstr(\"××××\", \".\", 0, 0) " × |
| 46 | :put =matchstr(\"××××\", \".\", 4, -1) " × |
| 47 | :w! |
| 48 | :qa! |
| 49 | ENDTEST |
| 50 | |
| 51 | 1 a aa abb abbccc |
| 52 | 2 d dd dee deefff |
| 53 | 3 g gg ghh ghhiii |
| 54 | 4 j jj jkk jkklll |
| 55 | 5 m mm mnn mnnooo |
| 56 | 6 x ^aa$ x |
| 57 | 7 (a)(b) abbaa |
| 58 | 8 axx [ab]xx |
| 59 | 9 หมà¹x à¸à¸¡x |
| 60 | a à¸à¸¡x หมà¹x |
| 61 | b ã¡ã«ã¨ã¯ |
| 62 | c x ¬â¬x |
| 63 | d 天使x |
| 64 | e ü
¸y |
| 65 | f ü¯z |
| 66 | g aå·bb |
Bram Moolenaar | 745c6eb | 2013-09-19 17:04:30 +0200 | [diff] [blame] | 67 | j 0123â¤x |
| 68 | k combinations |
Bram Moolenaar | 96c664a | 2015-12-31 16:21:52 +0100 | [diff] [blame] | 69 | l äö üαÌÌÌ |