Mercurial > vim
annotate src/testdir/test_regexp_utf8.vim @ 31437:ede2bd5f3426 v9.0.1051
patch 9.0.1051: after a failed CTRL-W ] next command splits window
Commit: https://github.com/vim/vim/commit/cb94c910706fdd575cc25797d7858e084f1e3524
Author: Rob Pilling <robpilling@gmail.com>
Date: Tue Dec 13 12:26:09 2022 +0000
patch 9.0.1051: after a failed CTRL-W ] next command splits window
Problem: After a failed CTRL-W ] next command splits window.
Solution: Reset postponed_split. (Rob Pilling, closes https://github.com/vim/vim/issues/11698)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 13 Dec 2022 13:30:04 +0100 |
parents | 2295ee9c025d |
children | 49d43532787f |
rev | line source |
---|---|
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for regexp in utf8 encoding |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
29527
e7158d889784
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
Bram Moolenaar <Bram@vim.org>
parents:
27835
diff
changeset
|
3 source shared.vim |
e7158d889784
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
Bram Moolenaar <Bram@vim.org>
parents:
27835
diff
changeset
|
4 |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 func s:equivalence_test() |
24351
585695c70392
patch 8.2.2716: the equivalent class regexp is missing some characters
Bram Moolenaar <Bram@vim.org>
parents:
23471
diff
changeset
|
6 let str = "AÀÁÂÃÄÅĀĂĄǍǞǠǺȂȦȺḀẠẢẤẦẨẪẬẮẰẲẴẶ BƁɃḂḄḆ CÇĆĈĊČƇȻḈꞒ DĎĐƊḊḌḎḐḒ EÈÉÊËĒĔĖĘĚȄȆȨɆḔḖḘḚḜẸẺẼẾỀỂỄỆ FƑḞꞘ GĜĞĠĢƓǤǦǴḠꞠ HĤĦȞḢḤḦḨḪⱧ IÌÍÎÏĨĪĬĮİƗǏȈȊḬḮỈỊ JĴɈ KĶƘǨḰḲḴⱩꝀ LĹĻĽĿŁȽḶḸḺḼⱠ MḾṀṂ NÑŃŅŇǸṄṆṈṊꞤ OÒÓÔÕÖØŌŎŐƟƠǑǪǬǾȌȎȪȬȮȰṌṎṐṒỌỎỐỒỔỖỘỚỜỞỠỢ PƤṔṖⱣ QɊ RŔŖŘȐȒɌṘṚṜṞⱤꞦ SŚŜŞŠȘṠṢṤṦṨⱾꞨ TŢŤŦƬƮȚȾṪṬṮṰ UÙÚÛÜŨŪŬŮŰƯǕǙǛǓǗȔȖɄṲṴṶṸṺỤỦỨỪỬỮỰ VƲṼṾ WŴẀẂẄẆẈ XẊẌ YÝŶŸƳȲɎẎỲỴỶỸ ZŹŻŽƵẐẒẔⱫ aàáâãäåāăąǎǟǡǻȃȧᶏḁẚạảấầẩẫậắằẳẵặⱥ bƀɓᵬᶀḃḅḇ cçćĉċčƈȼḉꞓꞔ dďđɗᵭᶁᶑḋḍḏḑḓ eèéêëēĕėęěȅȇȩɇᶒḕḗḙḛḝẹẻẽếềểễệ fƒᵮᶂḟꞙ gĝğġģǥǧǵɠᶃḡꞡ hĥħȟḣḥḧḩḫẖⱨꞕ iìíîïĩīĭįǐȉȋɨᶖḭḯỉị jĵǰɉ kķƙǩᶄḱḳḵⱪꝁ lĺļľŀłƚḷḹḻḽⱡ mᵯḿṁṃ nñńņňʼnǹᵰᶇṅṇṉṋꞥ oòóôõöøōŏőơǒǫǭǿȍȏȫȭȯȱɵṍṏṑṓọỏốồổỗộớờởỡợ pƥᵱᵽᶈṕṗ qɋʠ rŕŗřȑȓɍɽᵲᵳᶉṛṝṟꞧ sśŝşšșȿᵴᶊṡṣṥṧṩꞩ tţťŧƫƭțʈᵵṫṭṯṱẗⱦ uùúûüũūŭůűųǚǖưǔǘǜȕȗʉᵾᶙṳṵṷṹṻụủứừửữự vʋᶌṽṿ wŵẁẃẅẇẉẘ xẋẍ yýÿŷƴȳɏẏẙỳỵỷỹ zźżžƶᵶᶎẑẓẕⱬ" |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 let groups = split(str) |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 for group1 in groups |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 for c in split(group1, '\zs') |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 " next statement confirms that equivalence class matches every |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 " character in group |
24351
585695c70392
patch 8.2.2716: the equivalent class regexp is missing some characters
Bram Moolenaar <Bram@vim.org>
parents:
23471
diff
changeset
|
12 call assert_match('^[[=' .. c .. '=]]*$', group1) |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 for group2 in groups |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 if group2 != group1 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 " next statement converts that equivalence class doesn't match |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " character in any other group |
24351
585695c70392
patch 8.2.2716: the equivalent class regexp is missing some characters
Bram Moolenaar <Bram@vim.org>
parents:
23471
diff
changeset
|
17 call assert_equal(-1, match(group2, '[[=' .. c .. '=]]'), c) |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 endif |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfor |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 endfor |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 endfor |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 endfunc |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 func Test_equivalence_re1() |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 set re=1 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call s:equivalence_test() |
9896
7b39615c0db1
commit https://github.com/vim/vim/commit/6bff02eb530aa29aafa2cb5627399837be7a5dd5
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
27 set re=0 |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 endfunc |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 func Test_equivalence_re2() |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 set re=2 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call s:equivalence_test() |
9896
7b39615c0db1
commit https://github.com/vim/vim/commit/6bff02eb530aa29aafa2cb5627399837be7a5dd5
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
33 set re=0 |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 endfunc |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
35 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
36 func s:classes_test() |
21407
6d8696fd4945
patch 8.2.1254: MS-Windows: regexp test may fail if 'iskeyword' set wrongly
Bram Moolenaar <Bram@vim.org>
parents:
20772
diff
changeset
|
37 if has('win32') |
6d8696fd4945
patch 8.2.1254: MS-Windows: regexp test may fail if 'iskeyword' set wrongly
Bram Moolenaar <Bram@vim.org>
parents:
20772
diff
changeset
|
38 set iskeyword=@,48-57,_,192-255 |
6d8696fd4945
patch 8.2.1254: MS-Windows: regexp test may fail if 'iskeyword' set wrongly
Bram Moolenaar <Bram@vim.org>
parents:
20772
diff
changeset
|
39 endif |
8999
f414db42d167
commit https://github.com/vim/vim/commit/490465bda6ab66f78041709cc02f48a25486a3e5
Christian Brabandt <cb@256bit.org>
parents:
8995
diff
changeset
|
40 set isprint=@,161-255 |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
41 call assert_equal('Motörhead', matchstr('Motörhead', '[[:print:]]\+')) |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
42 |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
43 let alnumchars = '' |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
44 let alphachars = '' |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
45 let backspacechar = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
46 let blankchars = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
47 let cntrlchars = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
48 let digitchars = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
49 let escapechar = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
50 let graphchars = '' |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
51 let lowerchars = '' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
52 let printchars = '' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
53 let punctchars = '' |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
54 let returnchar = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
55 let spacechars = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
56 let tabchar = '' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
57 let upperchars = '' |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
58 let xdigitchars = '' |
15709
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
59 let identchars = '' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
60 let identchars1 = '' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
61 let kwordchars = '' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
62 let kwordchars1 = '' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
63 let fnamechars = '' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
64 let fnamechars1 = '' |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
65 let i = 1 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
66 while i <= 255 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
67 let c = nr2char(i) |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
68 if c =~ '[[:alpha:]]' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
69 let alphachars .= c |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
70 endif |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
71 if c =~ '[[:alnum:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
72 let alnumchars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
73 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
74 if c =~ '[[:backspace:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
75 let backspacechar .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
76 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
77 if c =~ '[[:blank:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
78 let blankchars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
79 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
80 if c =~ '[[:cntrl:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
81 let cntrlchars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
82 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
83 if c =~ '[[:digit:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
84 let digitchars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
85 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
86 if c =~ '[[:escape:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
87 let escapechar .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
88 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
89 if c =~ '[[:graph:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
90 let graphchars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
91 endif |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
92 if c =~ '[[:lower:]]' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
93 let lowerchars .= c |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
94 endif |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
95 if c =~ '[[:print:]]' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
96 let printchars .= c |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
97 endif |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
98 if c =~ '[[:punct:]]' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
99 let punctchars .= c |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
100 endif |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
101 if c =~ '[[:return:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
102 let returnchar .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
103 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
104 if c =~ '[[:space:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
105 let spacechars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
106 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
107 if c =~ '[[:tab:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
108 let tabchar .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
109 endif |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
110 if c =~ '[[:upper:]]' |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
111 let upperchars .= c |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
112 endif |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
113 if c =~ '[[:xdigit:]]' |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
114 let xdigitchars .= c |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
115 endif |
15709
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
116 if c =~ '[[:ident:]]' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
117 let identchars .= c |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
118 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
119 if c =~ '\i' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
120 let identchars1 .= c |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
121 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
122 if c =~ '[[:keyword:]]' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
123 let kwordchars .= c |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
124 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
125 if c =~ '\k' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
126 let kwordchars1 .= c |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
127 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
128 if c =~ '[[:fname:]]' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
129 let fnamechars .= c |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
130 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
131 if c =~ '\f' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
132 let fnamechars1 .= c |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
133 endif |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
134 let i += 1 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
135 endwhile |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
136 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
137 call assert_equal('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alphachars) |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
138 call assert_equal('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alnumchars) |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
139 call assert_equal("\b", backspacechar) |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
140 call assert_equal("\t ", blankchars) |
11287
e800e8149a5b
patch 8.0.0529: line in test commented out
Christian Brabandt <cb@256bit.org>
parents:
11267
diff
changeset
|
141 call assert_equal("\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0b\f\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\e\x1c\x1d\x1e\x1f\x7f", cntrlchars) |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
142 call assert_equal("0123456789", digitchars) |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
143 call assert_equal("\<Esc>", escapechar) |
11287
e800e8149a5b
patch 8.0.0529: line in test commented out
Christian Brabandt <cb@256bit.org>
parents:
11267
diff
changeset
|
144 call assert_equal('!"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', graphchars) |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
145 call assert_equal('abcdefghijklmnopqrstuvwxyzµßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ', lowerchars) |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
146 call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', printchars) |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
147 call assert_equal('!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~', punctchars) |
11267
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
148 call assert_equal('ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ', upperchars) |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
149 call assert_equal("\r", returnchar) |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
150 call assert_equal("\t\n\x0b\f\r ", spacechars) |
588de97b40e7
patch 8.0.0519: character classes are not well tested
Christian Brabandt <cb@256bit.org>
parents:
9898
diff
changeset
|
151 call assert_equal("\t", tabchar) |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
152 call assert_equal('0123456789ABCDEFabcdef', xdigitchars) |
15709
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
153 |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
154 if has('win32') |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
155 let identchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz ¡¢£¤¥¦§µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
156 let kwordchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzµÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
157 else |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
158 let identchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzµÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
159 let kwordchars_ok = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzµÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
160 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
161 |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
162 if has('win32') |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
163 let fnamechars_ok = '!#$%+,-./0123456789:=@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]_abcdefghijklmnopqrstuvwxyz{}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
164 elseif has('amiga') |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
165 let fnamechars_ok = '$+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
166 elseif has('vms') |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
167 let fnamechars_ok = '#$%+,-./0123456789:;<>ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
168 else |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
169 let fnamechars_ok = '#$%+,-./0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ' |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
170 endif |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
171 |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
172 call assert_equal(identchars_ok, identchars) |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
173 call assert_equal(kwordchars_ok, kwordchars) |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
174 call assert_equal(fnamechars_ok, fnamechars) |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
175 |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
176 call assert_equal(identchars1, identchars) |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
177 call assert_equal(kwordchars1, kwordchars) |
2e2f07561f4b
patch 8.1.0862: no verbose version of character classes
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
178 call assert_equal(fnamechars1, fnamechars) |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
179 endfunc |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
180 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
181 func Test_classes_re1() |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
182 set re=1 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
183 call s:classes_test() |
9896
7b39615c0db1
commit https://github.com/vim/vim/commit/6bff02eb530aa29aafa2cb5627399837be7a5dd5
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
184 set re=0 |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
185 endfunc |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
186 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
187 func Test_classes_re2() |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
188 set re=2 |
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
189 call s:classes_test() |
9896
7b39615c0db1
commit https://github.com/vim/vim/commit/6bff02eb530aa29aafa2cb5627399837be7a5dd5
Christian Brabandt <cb@256bit.org>
parents:
9618
diff
changeset
|
190 set re=0 |
8995
3cf6704d6efc
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
191 endfunc |
11480
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
192 |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
193 func Test_reversed_range() |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
194 for re in range(0, 2) |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
195 exe 'set re=' . re |
24351
585695c70392
patch 8.2.2716: the equivalent class regexp is missing some characters
Bram Moolenaar <Bram@vim.org>
parents:
23471
diff
changeset
|
196 call assert_fails('call match("abc def", "[c-a]")', 'E944:', re) |
11480
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
197 endfor |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
198 set re=0 |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
199 endfunc |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
200 |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
201 func Test_large_class() |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
202 set re=1 |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
203 call assert_fails('call match("abc def", "[\u3000-\u4000]")', 'E945:') |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
204 set re=2 |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
205 call assert_equal(0, 'abc def' =~# '[\u3000-\u4000]') |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
206 call assert_equal(1, "\u3042" =~# '[\u3000-\u4000]') |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
207 set re=0 |
99ce30ac4226
patch 8.0.0623: error for invalid regexp is not very informative
Christian Brabandt <cb@256bit.org>
parents:
11287
diff
changeset
|
208 endfunc |
17444
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
209 |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
210 func Test_optmatch_toolong() |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
211 set re=1 |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
212 " Can only handle about 8000 characters. |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
213 let pat = '\\%[' .. repeat('x', 9000) .. ']' |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
214 call assert_fails('call match("abc def", "' .. pat .. '")', 'E339:') |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
215 set re=0 |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
216 endfunc |
f4ce361bb1e5
patch 8.1.1720: crash with very long %[] pattern
Bram Moolenaar <Bram@vim.org>
parents:
15709
diff
changeset
|
217 |
18906
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
218 " Test for regexp patterns with multi-byte support, using utf-8. |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
219 func Test_multibyte_chars() |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
220 " tl is a List of Lists with: |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
221 " 2: test auto/old/new 0: test auto/old 1: test auto/new |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
222 " regexp pattern |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
223 " text to test the pattern on |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
224 " expected match (optional) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
225 " expected submatch 1 (optional) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
226 " expected submatch 2 (optional) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
227 " etc. |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
228 " When there is no match use only the first two items. |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
229 let tl = [] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
230 |
30731
2295ee9c025d
patch 9.0.0700: there is no real need for a "big" build
Bram Moolenaar <Bram@vim.org>
parents:
30669
diff
changeset
|
231 " Multi-byte character tests. |
18906
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
232 call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
233 call add(tl, [2, '[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
234 call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
235 call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
236 call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
237 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
238 " this is not a normal "i" but 0xec |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
239 call add(tl, [2, '\p\+', 'ìa', 'ìa']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
240 call add(tl, [2, '\p*', 'aあ', 'aあ']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
241 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
242 " Test recognition of some character classes |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
243 call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
244 call add(tl, [2, '\f\+', '&*fname ', 'fname']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
245 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
246 " Test composing character matching |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
247 call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
248 call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
249 call add(tl, [2, "\u05b9", " x\u05b9 ", "x\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
250 call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
251 call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
252 call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
253 call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
254 call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
255 call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
256 call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
257 call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
258 call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
259 call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
260 call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
261 call add(tl, [2, "a", "ca\u0300t"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
262 call add(tl, [2, "ca", "ca\u0300t"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
263 call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
264 call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
265 call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
266 call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
267 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
268 " Test \Z |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
269 call add(tl, [2, 'ú\Z', 'x']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
270 call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
271 call add(tl, [2, 'יְהוָה\Z', 'יהוה', 'יהוה']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
272 call add(tl, [2, 'יהוה\Z', 'יְהוָה', 'יְהוָה']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
273 call add(tl, [2, 'יְהוָה\Z', 'יְהוָה', 'יְהוָה']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
274 call add(tl, [2, 'יְ\Z', 'וְיַ', 'יַ']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
275 call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
276 call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
277 call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
278 call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
279 call add(tl, [2, "\u05b9\\Z", "xyz"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
280 call add(tl, [2, "\\Z\u05b9", "xyz"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
281 call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
282 call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
283 call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
284 call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
285 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
286 " Combining different tests and features |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
287 call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
288 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
289 " Run the tests |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
290 for t in tl |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
291 let re = t[0] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
292 let pat = t[1] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
293 let text = t[2] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
294 let matchidx = 3 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
295 for engine in [0, 1, 2] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
296 if engine == 2 && re == 0 || engine == 1 && re == 1 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
297 continue |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
298 endif |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
299 let ®expengine = engine |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
300 try |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
301 let l = matchlist(text, pat) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
302 catch |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
303 call assert_report('Error ' . engine . ': pat: \"' . pat . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
304 \ '\", text: \"' . text . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
305 \ '\", caused an exception: \"' . v:exception . '\"') |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
306 endtry |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
307 " check the match itself |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
308 if len(l) == 0 && len(t) > matchidx |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
309 call assert_report('Error ' . engine . ': pat: \"' . pat . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
310 \ '\", text: \"' . text . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
311 \ '\", did not match, expected: \"' . t[matchidx] . '\"') |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
312 elseif len(l) > 0 && len(t) == matchidx |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
313 call assert_report('Error ' . engine . ': pat: \"' . pat . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
314 \ '\", text: \"' . text . '\", match: \"' . l[0] . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
315 \ '\", expected no match') |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
316 elseif len(t) > matchidx && l[0] != t[matchidx] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
317 call assert_report('Error ' . engine . ': pat: \"' . pat . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
318 \ '\", text: \"' . text . '\", match: \"' . l[0] . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
319 \ '\", expected: \"' . t[matchidx] . '\"') |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
320 else |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
321 " Test passed |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
322 endif |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
323 if len(l) > 0 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
324 " check all the nine submatches |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
325 for i in range(1, 9) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
326 if len(t) <= matchidx + i |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
327 let e = '' |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
328 else |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
329 let e = t[matchidx + i] |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
330 endif |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
331 if l[i] != e |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
332 call assert_report('Error ' . engine . ': pat: \"' . pat . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
333 \ '\", text: \"' . text . '\", submatch ' . i . |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
334 \ ': \"' . l[i] . '\", expected: \"' . e . '\"') |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
335 endif |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
336 endfor |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
337 unlet i |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
338 endif |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
339 endfor |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
340 endfor |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
341 set regexpengine& |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
342 endfunc |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
343 |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
344 " check that 'ambiwidth' does not change the meaning of \p |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
345 func Test_ambiwidth() |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
346 set regexpengine=1 ambiwidth=single |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
347 call assert_equal(0, match("\u00EC", '\p')) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
348 set regexpengine=1 ambiwidth=double |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
349 call assert_equal(0, match("\u00EC", '\p')) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
350 set regexpengine=2 ambiwidth=single |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
351 call assert_equal(0, match("\u00EC", '\p')) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
352 set regexpengine=2 ambiwidth=double |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
353 call assert_equal(0, match("\u00EC", '\p')) |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
354 set regexpengine& ambiwidth& |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
355 endfunc |
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
356 |
20772
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
357 func Run_regexp_ignore_case() |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
358 call assert_equal('iIİ', substitute('iIİ', '\([iIİ]\)', '\1', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
359 |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
360 call assert_equal('iIx', substitute('iIİ', '\c\([İ]\)', 'x', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
361 call assert_equal('xxİ', substitute('iIİ', '\(i\c\)', 'x', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
362 call assert_equal('iIx', substitute('iIİ', '\(İ\c\)', 'x', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
363 call assert_equal('iIx', substitute('iIİ', '\c\(\%u0130\)', 'x', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
364 call assert_equal('iIx', substitute('iIİ', '\c\([\u0130]\)', 'x', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
365 call assert_equal('iIx', substitute('iIİ', '\c\([\u012f-\u0131]\)', 'x', 'g')) |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
366 endfunc |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
367 |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
368 func Test_regexp_ignore_case() |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
369 set regexpengine=1 |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
370 call Run_regexp_ignore_case() |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
371 set regexpengine=2 |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
372 call Run_regexp_ignore_case() |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
373 set regexpengine& |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
374 endfunc |
097f5b5c907b
patch 8.2.0938: NFA regexp uses tolower ()to compare ignore-case
Bram Moolenaar <Bram@vim.org>
parents:
18906
diff
changeset
|
375 |
21489
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
376 " Tests for regexp with multi-byte encoding and various magic settings |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
377 func Run_regexp_multibyte_magic() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
378 let text =<< trim END |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
379 1 a aa abb abbccc |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
380 2 d dd dee deefff |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
381 3 g gg ghh ghhiii |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
382 4 j jj jkk jkklll |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
383 5 m mm mnn mnnooo |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
384 6 x ^aa$ x |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
385 7 (a)(b) abbaa |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
386 8 axx [ab]xx |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
387 9 หม่x อมx |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
388 a อมx หม่x |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
389 b ちカヨは |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
390 c x ¬€x |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
391 d 天使x |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
392 e y |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
393 f z |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
394 g a啷bb |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
395 j 0123❤x |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
396 k combinations |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
397 l äö üᾱ̆́ |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
398 END |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
399 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
400 new |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
401 call setline(1, text) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
402 exe 'normal /a*b\{2}c\+/e' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
403 call assert_equal('1 a aa abb abbcc', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
404 exe 'normal /\Md\*e\{2}f\+/e' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
405 call assert_equal('2 d dd dee deeff', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
406 set nomagic |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
407 exe 'normal /g\*h\{2}i\+/e' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
408 call assert_equal('3 g gg ghh ghhii', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
409 exe 'normal /\mj*k\{2}l\+/e' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
410 call assert_equal('4 j jj jkk jkkll', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
411 exe 'normal /\vm*n{2}o+/e' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
412 call assert_equal('5 m mm mnn mnnoo', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
413 exe 'normal /\V^aa$/' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
414 call assert_equal('6 x aa$ x', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
415 set magic |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
416 exe 'normal /\v(a)(b)\2\1\1/e' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
417 call assert_equal('7 (a)(b) abba', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
418 exe 'normal /\V[ab]\(\[xy]\)\1' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
419 call assert_equal('8 axx ab]xx', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
420 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
421 " search for multi-byte without composing char |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
422 exe 'normal /ม' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
423 call assert_equal('9 หม่x อx', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
424 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
425 " search for multi-byte with composing char |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
426 exe 'normal /ม่' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
427 call assert_equal('a อมx หx', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
428 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
429 " find word by change of word class |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
430 exe 'normal /ち\<カヨ\>は' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
431 call assert_equal('b カヨは', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
432 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
433 " Test \%u, [\u] and friends |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
434 " c |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
435 exe 'normal /\%u20ac' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
436 call assert_equal('c x ¬x', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
437 " d |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
438 exe 'normal /[\u4f7f\u5929]\+' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
439 call assert_equal('d 使x', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
440 " e |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
441 exe 'normal /\%U12345678' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
442 call assert_equal('e y', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
443 " f |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
444 exe 'normal /[\U1234abcd\u1234\uabcd]' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
445 call assert_equal('f z', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
446 " g |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
447 exe 'normal /\%d21879b' .. "\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
448 call assert_equal('g abb', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
449 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
450 " j Test backwards search from a multi-byte char |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
451 exe "normal /x\<CR>x?.\<CR>x" |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
452 call assert_equal('j 012❤', getline('.')) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
453 " k |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
454 let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g' |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
455 @w |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
456 call assert_equal('k œ̄ṣ́m̥̄ᾱ̆́', getline(18)) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
457 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
458 close! |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
459 endfunc |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
460 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
461 func Test_regexp_multibyte_magic() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
462 set regexpengine=1 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
463 call Run_regexp_multibyte_magic() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
464 set regexpengine=2 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
465 call Run_regexp_multibyte_magic() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
466 set regexpengine& |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
467 endfunc |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
468 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
469 " Test for 7.3.192 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
470 " command ":s/ \?/ /g" splits multi-byte characters into bytes |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
471 func Test_split_multibyte_to_bytes() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
472 new |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
473 call setline(1, 'l äö üᾱ̆́') |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
474 s/ \?/ /g |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
475 call assert_equal(' l ä ö ü ᾱ̆́', getline(1)) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
476 close! |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
477 endfunc |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
478 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
479 " Test for matchstr() with multibyte characters |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
480 func Test_matchstr_multibyte() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
481 new |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
482 call assert_equal('ב', matchstr("אבגד", ".", 0, 2)) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
483 call assert_equal('בג', matchstr("אבגד", "..", 0, 2)) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
484 call assert_equal('א', matchstr("אבגד", ".", 0, 0)) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
485 call assert_equal('ג', matchstr("אבגד", ".", 4, -1)) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
486 close! |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
487 endfunc |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
488 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
489 " Test for 7.4.636 |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
490 " A search with end offset gets stuck at end of file. |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
491 func Test_search_with_end_offset() |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
492 new |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
493 call setline(1, ['', 'dog(a', 'cat(']) |
22476
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21489
diff
changeset
|
494 exe "normal /(/e+\<CR>" |
b3751f4d3b26
patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21489
diff
changeset
|
495 normal n"ayn |
21489
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
496 call assert_equal("a\ncat(", @a) |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
497 close! |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
498 endfunc |
c9a1b3b66fb7
patch 8.2.1295: tests 44 and 99 are old style
Bram Moolenaar <Bram@vim.org>
parents:
21407
diff
changeset
|
499 |
23262
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
500 " Check that "^" matches even when the line starts with a combining char |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
501 func Test_match_start_of_line_combining() |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
502 new |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
503 call setline(1, ['', "\u05ae", '']) |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
504 exe "normal gg/^\<CR>" |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
505 call assert_equal(2, getcurpos()[1]) |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
506 bwipe! |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
507 endfunc |
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
508 |
23471
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
509 " Check that [[:upper:]] matches for automatic engine |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
510 func Test_match_char_class_upper() |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
511 new |
23262
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
512 |
23471
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
513 " Test 1: [[:upper:]]\{2,\} |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
514 set regexpengine=0 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
515 call setline(1, ['05. ПЕСНЯ О ГЕРОЯХ муз. А. Давиденко, М. Коваля и Б. Шехтера ...', '05. PJESNJA O GJEROJAKH mus. A. Davidjenko, M. Kovalja i B. Shjekhtjera ...']) |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
516 call cursor(1,1) |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
517 let search_cmd='norm /\<[[:upper:]]\{2,\}\>' .. "\<CR>" |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
518 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
519 call assert_equal(4, searchcount().total, 'TEST 1') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
520 set regexpengine=1 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
521 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
522 call assert_equal(2, searchcount().total, 'TEST 1') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
523 set regexpengine=2 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
524 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
525 call assert_equal(4, searchcount().total, 'TEST 1') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
526 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
527 " Test 2: [[:upper:]].\+ |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
528 let search_cmd='norm /\<[[:upper:]].\+\>' .. "\<CR>" |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
529 set regexpengine=0 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
530 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
531 call assert_equal(2, searchcount().total, 'TEST 2') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
532 set regexpengine=1 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
533 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
534 call assert_equal(1, searchcount().total, 'TEST 2') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
535 set regexpengine=2 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
536 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
537 call assert_equal(2, searchcount().total, 'TEST 2') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
538 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
539 " Test 3: [[:lower:]]\+ |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
540 let search_cmd='norm /\<[[:lower:]]\+\>' .. "\<CR>" |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
541 set regexpengine=0 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
542 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
543 call assert_equal(4, searchcount().total, 'TEST 3 lower') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
544 set regexpengine=1 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
545 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
546 call assert_equal(2, searchcount().total, 'TEST 3 lower') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
547 set regexpengine=2 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
548 exe search_cmd |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
549 call assert_equal(4, searchcount().total, 'TEST 3 lower') |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
550 |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
551 " clean up |
27829
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
552 set regexpengine=0 |
23471
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
553 bwipe! |
a7cdfc8e4b6e
patch 8.2.2278: falling back to old regexp engine can some patterns
Bram Moolenaar <Bram@vim.org>
parents:
23262
diff
changeset
|
554 endfunc |
23262
dca9e6b931d3
patch 8.2.2177: pattern "^" does not match if first character is combining
Bram Moolenaar <Bram@vim.org>
parents:
22476
diff
changeset
|
555 |
25747
1c999a6e9d92
patch 8.2.3409: reading beyond end of line with invalid utf-8 character
Bram Moolenaar <Bram@vim.org>
parents:
24351
diff
changeset
|
556 func Test_match_invalid_byte() |
30669
de319bf98a39
patch 9.0.0669: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29529
diff
changeset
|
557 call writefile(0z630a.765d30aa0a.2e0a.790a.4030, 'Xinvalid', 'D') |
25747
1c999a6e9d92
patch 8.2.3409: reading beyond end of line with invalid utf-8 character
Bram Moolenaar <Bram@vim.org>
parents:
24351
diff
changeset
|
558 new |
1c999a6e9d92
patch 8.2.3409: reading beyond end of line with invalid utf-8 character
Bram Moolenaar <Bram@vim.org>
parents:
24351
diff
changeset
|
559 source Xinvalid |
1c999a6e9d92
patch 8.2.3409: reading beyond end of line with invalid utf-8 character
Bram Moolenaar <Bram@vim.org>
parents:
24351
diff
changeset
|
560 bwipe! |
1c999a6e9d92
patch 8.2.3409: reading beyond end of line with invalid utf-8 character
Bram Moolenaar <Bram@vim.org>
parents:
24351
diff
changeset
|
561 endfunc |
1c999a6e9d92
patch 8.2.3409: reading beyond end of line with invalid utf-8 character
Bram Moolenaar <Bram@vim.org>
parents:
24351
diff
changeset
|
562 |
29527
e7158d889784
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
Bram Moolenaar <Bram@vim.org>
parents:
27835
diff
changeset
|
563 func Test_match_illegal_byte() |
29529
893f448af76d
patch 9.0.0106: illegal byte regexp test doesn't fail when fix is reversed
Bram Moolenaar <Bram@vim.org>
parents:
29527
diff
changeset
|
564 " Text has illegal bytes which need to be set explicitly |
893f448af76d
patch 9.0.0106: illegal byte regexp test doesn't fail when fix is reversed
Bram Moolenaar <Bram@vim.org>
parents:
29527
diff
changeset
|
565 let lines = ["norm :set no\x01\<CR>", "silent n\xff", "silent norm :b\xff\<CR>"] |
30669
de319bf98a39
patch 9.0.0669: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
29529
diff
changeset
|
566 call writefile(lines, 'Xregexp', 'D') |
29527
e7158d889784
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
Bram Moolenaar <Bram@vim.org>
parents:
27835
diff
changeset
|
567 call system(GetVimCommand() .. ' -X -Z -e -s -S Xregexp -c qa!') |
e7158d889784
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
Bram Moolenaar <Bram@vim.org>
parents:
27835
diff
changeset
|
568 endfunc |
e7158d889784
patch 9.0.0105: illegal memory access when pattern starts with illegal byte
Bram Moolenaar <Bram@vim.org>
parents:
27835
diff
changeset
|
569 |
27829
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
570 func Test_match_too_complicated() |
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
571 set regexpengine=1 |
27835
0815a43eebce
patch 8.2.4443: regexp pattern test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents:
27829
diff
changeset
|
572 exe "noswapfile vsplit \xeb\xdb\x99" |
27829
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
573 silent! buf \&\zs*\zs*0 |
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
574 bwipe! |
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
575 set regexpengine=0 |
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
576 endfunc |
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
577 |
0138ce89703b
patch 8.2.4440: crash with specific regexp pattern and string
Bram Moolenaar <Bram@vim.org>
parents:
27490
diff
changeset
|
578 |
18906
bb87c5c1e29b
patch 8.2.0014: test69 and test95 are old style
Bram Moolenaar <Bram@vim.org>
parents:
17444
diff
changeset
|
579 " vim: shiftwidth=2 sts=2 expandtab |