Mercurial > vim
annotate src/testdir/test_regexp_latin.vim @ 28333:04310f81143d v8.2.4692
patch 8.2.4692: no test for what 8.2.4691 fixes
Commit: https://github.com/vim/vim/commit/0f68e6c07aaf62c034a242f183b93c1bb44e7f93
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Apr 5 13:17:01 2022 +0100
patch 8.2.4692: no test for what 8.2.4691 fixes
Problem: No test for what 8.2.4691 fixes.
Solution: Add a test. Use a more generic sotlution. (closes https://github.com/vim/vim/issues/10090)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 05 Apr 2022 14:30:03 +0200 |
parents | a3a760ee765f |
children | 786707ef91de |
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 latin1 encoding |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
2 |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 set encoding=latin1 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 scriptencoding latin1 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
18898
diff
changeset
|
6 source check.vim |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
18898
diff
changeset
|
7 |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 func s:equivalence_test() |
26907
6f43253463cc
patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
26843
diff
changeset
|
9 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 ' |
6f43253463cc
patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
26843
diff
changeset
|
10 \ .. '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 ' |
6f43253463cc
patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
26843
diff
changeset
|
11 \ .. "0 1 2 3 4 5 6 7 8 9 " |
6f43253463cc
patch 8.2.3982: some lines of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
26843
diff
changeset
|
12 \ .. "` ~ ! ? ; : . , / \\ ' \" | < > [ ] { } ( ) @ # $ % ^ & * _ - + \b \e \f \n \r \t" |
8825
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let groups = split(str) |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 for group1 in groups |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 for c in split(group1, '\zs') |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " 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
|
17 " character in group |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_match('^[[=' . c . '=]]*$', group1) |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 for group2 in groups |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 if group2 != group1 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 " 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
|
22 " a character in any other group |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal(-1, match(group2, '[[=' . c . '=]]')) |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endif |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 endfor |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endfor |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 endfor |
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_re1() |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 set re=1 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call s:equivalence_test() |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 endfunc |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 func Test_equivalence_re2() |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 set re=2 |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call s:equivalence_test() |
318eaa6fa973
commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 endfunc |
9890
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
39 |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
40 func Test_recursive_substitute() |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
41 new |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
42 s/^/\=execute("s#^##gn") |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
43 " check we are now not in the sandbox |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
44 call setwinvar(1, 'myvar', 1) |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
45 bwipe! |
064effd222a3
commit https://github.com/vim/vim/commit/f5a39447a8ebe162ee62caa2ee502cd0e65eecaa
Christian Brabandt <cb@256bit.org>
parents:
8825
diff
changeset
|
46 endfunc |
10168
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
47 |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
48 func Test_nested_backrefs() |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
49 " Check example in change.txt. |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
50 new |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
51 for re in range(0, 2) |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
52 exe 'set re=' . re |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
53 call setline(1, 'aa ab x') |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
54 1s/\(\(a[a-d] \)*\)\(x\)/-\1- -\2- -\3-/ |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
55 call assert_equal('-aa ab - -ab - -x-', getline(1)) |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
56 |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
57 call assert_equal('-aa ab - -ab - -x-', substitute('aa ab x', '\(\(a[a-d] \)*\)\(x\)', '-\1- -\2- -\3-', '')) |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
58 endfor |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
59 bwipe! |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
60 set re=0 |
3c37899baa8d
commit https://github.com/vim/vim/commit/d563883a1fb5ec6cf4a2758c5e36ac1ff4e9bb3d
Christian Brabandt <cb@256bit.org>
parents:
9909
diff
changeset
|
61 endfunc |
10170
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
62 |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
63 func Test_eow_with_optional() |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
64 let expected = ['abc def', 'abc', 'def', '', '', '', '', '', '', ''] |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
65 for re in range(0, 2) |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
66 exe 'set re=' . re |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
67 let actual = matchlist('abc def', '\(abc\>\)\?\s*\(def\)') |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
68 call assert_equal(expected, actual) |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
69 endfor |
4acacf4081ce
commit https://github.com/vim/vim/commit/16b3578f355282846f2600ce77fb344950f0b9ce
Christian Brabandt <cb@256bit.org>
parents:
10168
diff
changeset
|
70 endfunc |
11525
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
71 |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
72 func Test_backref() |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
73 new |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
74 call setline(1, ['one', 'two', 'three', 'four', 'five']) |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
75 call assert_equal(3, search('\%#=1\(e\)\1')) |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
76 call assert_equal(3, search('\%#=2\(e\)\1')) |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
77 call assert_fails('call search("\\%#=1\\(e\\1\\)")', 'E65:') |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
78 call assert_fails('call search("\\%#=2\\(e\\1\\)")', 'E65:') |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
79 bwipe! |
14b6b79d685b
patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents:
10170
diff
changeset
|
80 endfunc |
15486
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
81 |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
82 func Test_multi_failure() |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
83 set re=1 |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
84 call assert_fails('/a**', 'E61:') |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
85 call assert_fails('/a*\+', 'E62:') |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
86 call assert_fails('/a\{a}', 'E554:') |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
87 set re=2 |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
88 call assert_fails('/a**', 'E871:') |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
89 call assert_fails('/a*\+', 'E871:') |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
19969
diff
changeset
|
90 call assert_fails('/a\{a}', 'E554:') |
15486
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
91 set re=0 |
b143545e3354
patch 8.1.0751: some regexp errors are not tested
Bram Moolenaar <Bram@vim.org>
parents:
11525
diff
changeset
|
92 endfunc |
15796
481452f6687c
patch 8.1.0905: complicated regexp causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
15486
diff
changeset
|
93 |
28325
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
94 func Test_column_failure() |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
95 set re=1 |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
96 call assert_fails('/\%v', 'E71:') |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
97 call assert_fails('/\%c', 'E71:') |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
98 call assert_fails('/\%l', 'E71:') |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
99 set re=2 |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
100 call assert_fails('/\%v', 'E1273:') |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
101 call assert_fails('/\%c', 'E1273:') |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
102 call assert_fails('/\%l', 'E1273:') |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
103 set re=0 |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
104 endfunc |
a3a760ee765f
patch 8.2.4688: new regexp engine does not give an error for "%v"
Bram Moolenaar <Bram@vim.org>
parents:
28240
diff
changeset
|
105 |
15796
481452f6687c
patch 8.1.0905: complicated regexp causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
15486
diff
changeset
|
106 func Test_recursive_addstate() |
481452f6687c
patch 8.1.0905: complicated regexp causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
15486
diff
changeset
|
107 " This will call addstate() recursively until it runs into the limit. |
481452f6687c
patch 8.1.0905: complicated regexp causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
15486
diff
changeset
|
108 let lnum = search('\v((){328}){389}') |
481452f6687c
patch 8.1.0905: complicated regexp causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
15486
diff
changeset
|
109 call assert_equal(0, lnum) |
481452f6687c
patch 8.1.0905: complicated regexp causes a crash
Bram Moolenaar <Bram@vim.org>
parents:
15486
diff
changeset
|
110 endfunc |
15806
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
111 |
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
112 func Test_out_of_memory() |
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
113 new |
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
114 s/^/,n |
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
115 " This will be slow... |
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
116 call assert_fails('call search("\\v((n||<)+);")', 'E363:') |
6a4e9d9f1d66
patch 8.1.0910: crash with tricky search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15796
diff
changeset
|
117 endfunc |
15854
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
118 |
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
119 func Test_get_equi_class() |
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
120 new |
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
121 " Incomplete equivalence class caused invalid memory access |
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
122 s/^/[[= |
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
123 call assert_equal(1, search(getline(1))) |
15860
9cd9bf2897de
patch 8.1.0937: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15856
diff
changeset
|
124 s/.*/[[. |
9cd9bf2897de
patch 8.1.0937: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15856
diff
changeset
|
125 call assert_equal(1, search(getline(1))) |
15854
4ac1c185b0b8
patch 8.1.0934: invalid memory access in search pattern
Bram Moolenaar <Bram@vim.org>
parents:
15806
diff
changeset
|
126 endfunc |
15856
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
127 |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
128 func Test_rex_init() |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
129 set noincsearch |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
130 set re=1 |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
131 new |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
132 setlocal iskeyword=a-z |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
133 call setline(1, ['abc', 'ABC']) |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
134 call assert_equal(1, search('[[:keyword:]]')) |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
135 new |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
136 setlocal iskeyword=A-Z |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
137 call setline(1, ['abc', 'ABC']) |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
138 call assert_equal(2, search('[[:keyword:]]')) |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
139 bwipe! |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
140 bwipe! |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
141 set re=0 |
e44b7caaf373
patch 8.1.0935: old regexp engine may use invalid buffer
Bram Moolenaar <Bram@vim.org>
parents:
15854
diff
changeset
|
142 endfunc |
15876
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
143 |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
144 func Test_range_with_newline() |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
145 new |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
146 call setline(1, "a") |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
147 call assert_equal(0, search("[ -*\\n- ]")) |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
148 call assert_equal(0, search("[ -*\\t-\\n]")) |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
149 bwipe! |
0c49755f460e
patch 8.1.0945: internal error when using pattern with NL in the range
Bram Moolenaar <Bram@vim.org>
parents:
15860
diff
changeset
|
150 endfunc |
15904
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
151 |
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
152 func Test_pattern_compile_speed() |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
18898
diff
changeset
|
153 CheckOption spellcapcheck |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
18898
diff
changeset
|
154 CheckFunction reltimefloat |
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
18898
diff
changeset
|
155 |
15904
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
156 let start = reltime() |
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
157 " this used to be very slow, not it should be about a second |
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
158 set spc=\\v(((((Nxxxxxxx&&xxxx){179})+)+)+){179} |
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
159 call assert_inrange(0.01, 10.0, reltimefloat(reltime(start))) |
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
160 set spc= |
fec4416adb80
patch 8.1.0958: compiling weird regexp pattern is very slow
Bram Moolenaar <Bram@vim.org>
parents:
15876
diff
changeset
|
161 endfunc |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
162 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
163 " Tests for regexp patterns without multi-byte support. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
164 func Test_regexp_single_line_pat() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
165 " tl is a List of Lists with: |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
166 " regexp engines to test |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
167 " 0 - test with 'regexpengine' values 0 and 1 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
168 " 1 - test with 'regexpengine' values 0 and 2 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
169 " 2 - test with 'regexpengine' values 0, 1 and 2 |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
170 " regexp pattern |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
171 " text to test the pattern on |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
172 " expected match (optional) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
173 " expected submatch 1 (optional) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
174 " expected submatch 2 (optional) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
175 " etc. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
176 " When there is no match use only the first two items. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
177 let tl = [] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
178 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
179 call add(tl, [2, 'ab', 'aab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
180 call add(tl, [2, 'b', 'abcdef', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
181 call add(tl, [2, 'bc*', 'abccccdef', 'bcccc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
182 call add(tl, [2, 'bc\{-}', 'abccccdef', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
183 call add(tl, [2, 'bc\{-}\(d\)', 'abccccdef', 'bccccd', 'd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
184 call add(tl, [2, 'bc*', 'abbdef', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
185 call add(tl, [2, 'c*', 'ccc', 'ccc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
186 call add(tl, [2, 'bc*', 'abdef', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
187 call add(tl, [2, 'c*', 'abdef', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
188 call add(tl, [2, 'bc\+', 'abccccdef', 'bcccc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
189 call add(tl, [2, 'bc\+', 'abdef']) " no match |
19969
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19958
diff
changeset
|
190 " match escape character in a string |
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19958
diff
changeset
|
191 call add(tl, [2, '.\e.', "one\<Esc>two", "e\<Esc>t"]) |
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19958
diff
changeset
|
192 " match backspace character in a string |
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19958
diff
changeset
|
193 call add(tl, [2, '.\b.', "one\<C-H>two", "e\<C-H>t"]) |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
194 " match newline character in a string |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
195 call add(tl, [2, 'o\nb', "foo\nbar", "o\nb"]) |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
196 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
197 " operator \| |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
198 call add(tl, [2, 'a\|ab', 'cabd', 'a']) " alternation is ordered |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
199 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
200 call add(tl, [2, 'c\?', 'ccb', 'c']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
201 call add(tl, [2, 'bc\?', 'abd', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
202 call add(tl, [2, 'bc\?', 'abccd', 'bc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
203 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
204 call add(tl, [2, '\va{1}', 'ab', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
205 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
206 call add(tl, [2, '\va{2}', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
207 call add(tl, [2, '\va{2}', 'caad', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
208 call add(tl, [2, '\va{2}', 'aba']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
209 call add(tl, [2, '\va{2}', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
210 call add(tl, [2, '\va{2}', 'abaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
211 call add(tl, [2, '\va{2}', 'aaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
212 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
213 call add(tl, [2, '\vb{1}', 'abca', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
214 call add(tl, [2, '\vba{2}', 'abaa', 'baa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
215 call add(tl, [2, '\vba{3}', 'aabaac']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
216 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
217 call add(tl, [2, '\v(ab){1}', 'ab', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
218 call add(tl, [2, '\v(ab){1}', 'dabc', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
219 call add(tl, [2, '\v(ab){1}', 'acb']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
220 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
221 call add(tl, [2, '\v(ab){0,2}', 'acb', "", ""]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
222 call add(tl, [2, '\v(ab){0,2}', 'ab', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
223 call add(tl, [2, '\v(ab){1,2}', 'ab', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
224 call add(tl, [2, '\v(ab){1,2}', 'ababc', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
225 call add(tl, [2, '\v(ab){2,4}', 'ababcab', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
226 call add(tl, [2, '\v(ab){2,4}', 'abcababa', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
227 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
228 call add(tl, [2, '\v(ab){2}', 'abab', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
229 call add(tl, [2, '\v(ab){2}', 'cdababe', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
230 call add(tl, [2, '\v(ab){2}', 'abac']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
231 call add(tl, [2, '\v(ab){2}', 'abacabab', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
232 call add(tl, [2, '\v((ab){2}){2}', 'abababab', 'abababab', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
233 call add(tl, [2, '\v((ab){2}){2}', 'abacabababab', 'abababab', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
234 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
235 call add(tl, [2, '\v(a{1}){1}', 'a', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
236 call add(tl, [2, '\v(a{2}){1}', 'aa', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
237 call add(tl, [2, '\v(a{2}){1}', 'aaac', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
238 call add(tl, [2, '\v(a{2}){1}', 'daaac', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
239 call add(tl, [2, '\v(a{1}){2}', 'daaac', 'aa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
240 call add(tl, [2, '\v(a{1}){2}', 'aaa', 'aa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
241 call add(tl, [2, '\v(a{2})+', 'adaac', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
242 call add(tl, [2, '\v(a{2})+', 'aa', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
243 call add(tl, [2, '\v(a{2}){1}', 'aa', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
244 call add(tl, [2, '\v(a{1}){2}', 'aa', 'aa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
245 call add(tl, [2, '\v(a{1}){1}', 'a', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
246 call add(tl, [2, '\v(a{2}){2}', 'aaaa', 'aaaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
247 call add(tl, [2, '\v(a{2}){2}', 'aaabaaaa', 'aaaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
248 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
249 call add(tl, [2, '\v(a+){2}', 'dadaac', 'aa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
250 call add(tl, [2, '\v(a{3}){2}', 'aaaaaaa', 'aaaaaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
251 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
252 call add(tl, [2, '\v(a{1,2}){2}', 'daaac', 'aaa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
253 call add(tl, [2, '\v(a{1,3}){2}', 'daaaac', 'aaaa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
254 call add(tl, [2, '\v(a{1,3}){2}', 'daaaaac', 'aaaaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
255 call add(tl, [2, '\v(a{1,3}){3}', 'daac']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
256 call add(tl, [2, '\v(a{1,2}){2}', 'dac']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
257 call add(tl, [2, '\v(a+)+', 'daac', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
258 call add(tl, [2, '\v(a+)+', 'aaa', 'aaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
259 call add(tl, [2, '\v(a+){1,2}', 'aaa', 'aaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
260 call add(tl, [2, '\v(a+)(a+)', 'aaa', 'aaa', 'aa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
261 call add(tl, [2, '\v(a{3})+', 'daaaac', 'aaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
262 call add(tl, [2, '\v(a|b|c)+', 'aacb', 'aacb', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
263 call add(tl, [2, '\v(a|b|c){2}', 'abcb', 'ab', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
264 call add(tl, [2, '\v(abc){2}', 'abcabd', ]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
265 call add(tl, [2, '\v(abc){2}', 'abdabcabc','abcabc', 'abc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
266 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
267 call add(tl, [2, 'a*', 'cc', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
268 call add(tl, [2, '\v(a*)+', 'cc', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
269 call add(tl, [2, '\v((ab)+)+', 'ab', 'ab', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
270 call add(tl, [2, '\v(((ab)+)+)+', 'ab', 'ab', 'ab', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
271 call add(tl, [2, '\v(((ab)+)+)+', 'dababc', 'abab', 'abab', 'abab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
272 call add(tl, [2, '\v(a{0,2})+', 'cc', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
273 call add(tl, [2, '\v(a*)+', '', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
274 call add(tl, [2, '\v((a*)+)+', '', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
275 call add(tl, [2, '\v((ab)*)+', '', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
276 call add(tl, [2, '\va{1,3}', 'aab', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
277 call add(tl, [2, '\va{2,3}', 'abaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
278 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
279 call add(tl, [2, '\v((ab)+|c*)+', 'abcccaba', 'abcccab', '', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
280 call add(tl, [2, '\v(a{2})|(b{3})', 'bbabbbb', 'bbb', '', 'bbb']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
281 call add(tl, [2, '\va{2}|b{2}', 'abab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
282 call add(tl, [2, '\v(a)+|(c)+', 'bbacbaacbbb', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
283 call add(tl, [2, '\vab{2,3}c', 'aabbccccccccccccc', 'abbc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
284 call add(tl, [2, '\vab{2,3}c', 'aabbbccccccccccccc', 'abbbc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
285 call add(tl, [2, '\vab{2,3}cd{2,3}e', 'aabbbcddee', 'abbbcdde']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
286 call add(tl, [2, '\va(bc){2}d', 'aabcbfbc' ]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
287 call add(tl, [2, '\va*a{2}', 'a', ]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
288 call add(tl, [2, '\va*a{2}', 'aa', 'aa' ]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
289 call add(tl, [2, '\va*a{2}', 'aaa', 'aaa' ]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
290 call add(tl, [2, '\va*a{2}', 'bbbabcc', ]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
291 call add(tl, [2, '\va*b*|a*c*', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
292 call add(tl, [2, '\va{1}b{1}|a{1}b{1}', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
293 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
294 " submatches |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
295 call add(tl, [2, '\v(a)', 'ab', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
296 call add(tl, [2, '\v(a)(b)', 'ab', 'ab', 'a', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
297 call add(tl, [2, '\v(ab)(b)(c)', 'abbc', 'abbc', 'ab', 'b', 'c']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
298 call add(tl, [2, '\v((a)(b))', 'ab', 'ab', 'ab', 'a', 'b']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
299 call add(tl, [2, '\v(a)|(b)', 'ab', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
300 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
301 call add(tl, [2, '\v(a*)+', 'aaaa', 'aaaa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
302 call add(tl, [2, 'x', 'abcdef']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
303 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
304 " |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
305 " Simple tests |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
306 " |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
307 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
308 " Search single groups |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
309 call add(tl, [2, 'ab', 'aab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
310 call add(tl, [2, 'ab', 'baced']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
311 call add(tl, [2, 'ab', ' ab ', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
312 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
313 " Search multi-modifiers |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
314 call add(tl, [2, 'x*', 'xcd', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
315 call add(tl, [2, 'x*', 'xxxxxxxxxxxxxxxxsofijiojgf', 'xxxxxxxxxxxxxxxx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
316 " empty match is good |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
317 call add(tl, [2, 'x*', 'abcdoij', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
318 " no match here |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
319 call add(tl, [2, 'x\+', 'abcdoin']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
320 call add(tl, [2, 'x\+', 'abcdeoijdfxxiuhfij', 'xx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
321 call add(tl, [2, 'x\+', 'xxxxx', 'xxxxx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
322 call add(tl, [2, 'x\+', 'abc x siufhiush xxxxxxxxx', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
323 call add(tl, [2, 'x\=', 'x sdfoij', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
324 call add(tl, [2, 'x\=', 'abc sfoij', '']) " empty match is good |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
325 call add(tl, [2, 'x\=', 'xxxxxxxxx c', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
326 call add(tl, [2, 'x\?', 'x sdfoij', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
327 " empty match is good |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
328 call add(tl, [2, 'x\?', 'abc sfoij', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
329 call add(tl, [2, 'x\?', 'xxxxxxxxxx c', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
330 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
331 call add(tl, [2, 'a\{0,0}', 'abcdfdoij', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
332 " same thing as 'a?' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
333 call add(tl, [2, 'a\{0,1}', 'asiubid axxxaaa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
334 " same thing as 'a\{0,1}' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
335 call add(tl, [2, 'a\{1,0}', 'asiubid axxxaaa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
336 call add(tl, [2, 'a\{3,6}', 'aa siofuh']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
337 call add(tl, [2, 'a\{3,6}', 'aaaaa asfoij afaa', 'aaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
338 call add(tl, [2, 'a\{3,6}', 'aaaaaaaa', 'aaaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
339 call add(tl, [2, 'a\{0}', 'asoiuj', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
340 call add(tl, [2, 'a\{2}', 'aaaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
341 call add(tl, [2, 'a\{2}', 'iuash fiusahfliusah fiushfilushfi uhsaifuh askfj nasfvius afg aaaa sfiuhuhiushf', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
342 call add(tl, [2, 'a\{2}', 'abcdefghijklmnopqrestuvwxyz1234567890']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
343 " same thing as 'a*' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
344 call add(tl, [2, 'a\{0,}', 'oij sdigfusnf', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
345 call add(tl, [2, 'a\{0,}', 'aaaaa aa', 'aaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
346 call add(tl, [2, 'a\{2,}', 'sdfiougjdsafg']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
347 call add(tl, [2, 'a\{2,}', 'aaaaasfoij ', 'aaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
348 call add(tl, [2, 'a\{5,}', 'xxaaaaxxx ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
349 call add(tl, [2, 'a\{5,}', 'xxaaaaaxxx ', 'aaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
350 call add(tl, [2, 'a\{,0}', 'oidfguih iuhi hiu aaaa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
351 call add(tl, [2, 'a\{,5}', 'abcd', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
352 call add(tl, [2, 'a\{,5}', 'aaaaaaaaaa', 'aaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
353 " leading star as normal char when \{} follows |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
354 call add(tl, [2, '^*\{4,}$', '***']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
355 call add(tl, [2, '^*\{4,}$', '****', '****']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
356 call add(tl, [2, '^*\{4,}$', '*****', '*****']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
357 " same thing as 'a*' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
358 call add(tl, [2, 'a\{}', 'bbbcddiuhfcd', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
359 call add(tl, [2, 'a\{}', 'aaaaioudfh coisf jda', 'aaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
360 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
361 call add(tl, [2, 'a\{-0,0}', 'abcdfdoij', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
362 " anti-greedy version of 'a?' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
363 call add(tl, [2, 'a\{-0,1}', 'asiubid axxxaaa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
364 call add(tl, [2, 'a\{-3,6}', 'aa siofuh']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
365 call add(tl, [2, 'a\{-3,6}', 'aaaaa asfoij afaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
366 call add(tl, [2, 'a\{-3,6}', 'aaaaaaaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
367 call add(tl, [2, 'a\{-0}', 'asoiuj', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
368 call add(tl, [2, 'a\{-2}', 'aaaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
369 call add(tl, [2, 'a\{-2}', 'abcdefghijklmnopqrestuvwxyz1234567890']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
370 call add(tl, [2, 'a\{-0,}', 'oij sdigfusnf', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
371 call add(tl, [2, 'a\{-0,}', 'aaaaa aa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
372 call add(tl, [2, 'a\{-2,}', 'sdfiougjdsafg']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
373 call add(tl, [2, 'a\{-2,}', 'aaaaasfoij ', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
374 call add(tl, [2, 'a\{-,0}', 'oidfguih iuhi hiu aaaa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
375 call add(tl, [2, 'a\{-,5}', 'abcd', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
376 call add(tl, [2, 'a\{-,5}', 'aaaaaaaaaa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
377 " anti-greedy version of 'a*' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
378 call add(tl, [2, 'a\{-}', 'bbbcddiuhfcd', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
379 call add(tl, [2, 'a\{-}', 'aaaaioudfh coisf jda', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
380 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
381 " Test groups of characters and submatches |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
382 call add(tl, [2, '\(abc\)*', 'abcabcabc', 'abcabcabc', 'abc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
383 call add(tl, [2, '\(ab\)\+', 'abababaaaaa', 'ababab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
384 call add(tl, [2, '\(abaaaaa\)*cd', 'cd', 'cd', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
385 call add(tl, [2, '\(test1\)\? \(test2\)\?', 'test1 test3', 'test1 ', 'test1', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
386 call add(tl, [2, '\(test1\)\= \(test2\) \(test4443\)\=', ' test2 test4443 yupiiiiiiiiiii', ' test2 test4443', '', 'test2', 'test4443']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
387 call add(tl, [2, '\(\(sub1\) hello \(sub 2\)\)', 'asterix sub1 hello sub 2 obelix', 'sub1 hello sub 2', 'sub1 hello sub 2', 'sub1', 'sub 2']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
388 call add(tl, [2, '\(\(\(yyxxzz\)\)\)', 'abcdddsfiusfyyzzxxyyxxzz', 'yyxxzz', 'yyxxzz', 'yyxxzz', 'yyxxzz']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
389 call add(tl, [2, '\v((ab)+|c+)+', 'abcccaba', 'abcccab', 'ab', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
390 call add(tl, [2, '\v((ab)|c*)+', 'abcccaba', 'abcccab', '', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
391 call add(tl, [2, '\v(a(c*)+b)+', 'acbababaaa', 'acbabab', 'ab', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
392 call add(tl, [2, '\v(a|b*)+', 'aaaa', 'aaaa', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
393 call add(tl, [2, '\p*', 'aá ', 'aá ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
394 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
395 " Test greedy-ness and lazy-ness |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
396 call add(tl, [2, 'a\{-2,7}','aaaaaaaaaaaaa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
397 call add(tl, [2, 'a\{-2,7}x','aaaaaaaaax', 'aaaaaaax']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
398 call add(tl, [2, 'a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
399 call add(tl, [2, 'a\{2,7}x','aaaaaaaaax', 'aaaaaaax']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
400 call add(tl, [2, '\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
401 call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa','']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
402 call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
403 call add(tl, [2, '\v(a{-1,3})+', 'aa', 'aa', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
404 call add(tl, [2, '^\s\{-}\zs\( x\|x$\)', ' x', ' x', ' x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
405 call add(tl, [2, '^\s\{-}\zs\(x\| x$\)', ' x', ' x', ' x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
406 call add(tl, [2, '^\s\{-}\ze\(x\| x$\)', ' x', '', ' x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
407 call add(tl, [2, '^\(\s\{-}\)\(x\| x$\)', ' x', ' x', '', ' x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
408 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
409 " Test Character classes |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
410 call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
411 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
412 " Test collections and character range [] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
413 call add(tl, [2, '\v[a]', 'abcd', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
414 call add(tl, [2, 'a[bcd]', 'abcd', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
415 call add(tl, [2, 'a[b-d]', 'acbd', 'ac']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
416 call add(tl, [2, '[a-d][e-f][x-x]d', 'cexdxx', 'cexd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
417 call add(tl, [2, '\v[[:alpha:]]+', 'abcdefghijklmnopqrstuvwxyz6','abcdefghijklmnopqrstuvwxyz']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
418 call add(tl, [2, '[[:alpha:]\+]', '6x8','x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
419 call add(tl, [2, '[^abc]\+','abcabcabc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
420 call add(tl, [2, '[^abc]','defghiasijvoinasoiunbvb','d']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
421 call add(tl, [2, '[^abc]\+','ddddddda','ddddddd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
422 call add(tl, [2, '[^a-d]\+','aaaAAAZIHFNCddd','AAAZIHFNC']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
423 call add(tl, [2, '[a-f]*','iiiiiiii','']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
424 call add(tl, [2, '[a-f]*','abcdefgh','abcdef']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
425 call add(tl, [2, '[^a-f]\+','abcdefgh','gh']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
426 call add(tl, [2, '[a-c]\{-3,6}','abcabc','abc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
427 call add(tl, [2, '[^[:alpha:]]\+','abcccadfoij7787ysf287yrnccdu','7787']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
428 call add(tl, [2, '[-a]', '-', '-']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
429 call add(tl, [2, '[a-]', '-', '-']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
430 call add(tl, [2, '[a-f]*\c','ABCDEFGH','ABCDEF']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
431 call add(tl, [2, '[abc][xyz]\c','-af-AF-BY--','BY']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
432 " filename regexp |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
433 call add(tl, [2, '[-./[:alnum:]_~]\+', 'log13.file', 'log13.file']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
434 " special chars |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
435 call add(tl, [2, '[\]\^\-\\]\+', '\^\\\-\---^', '\^\\\-\---^']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
436 " collation elem |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
437 call add(tl, [2, '[[.a.]]\+', 'aa', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
438 " middle of regexp |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
439 call add(tl, [2, 'abc[0-9]*ddd', 'siuhabc ii']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
440 call add(tl, [2, 'abc[0-9]*ddd', 'adf abc44482ddd oijs', 'abc44482ddd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
441 call add(tl, [2, '\_[0-9]\+', 'asfi9888u', '9888']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
442 call add(tl, [2, '[0-9\n]\+', 'asfi9888u', '9888']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
443 call add(tl, [2, '\_[0-9]\+', "asfi\n9888u", "\n9888"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
444 call add(tl, [2, '\_f', " \na ", "\n"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
445 call add(tl, [2, '\_f\+', " \na ", "\na"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
446 call add(tl, [2, '[0-9A-Za-z-_.]\+', " @0_a.A-{ ", "0_a.A-"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
447 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
448 " Test start/end of line, start/end of file |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
449 call add(tl, [2, '^a.', "a_\nb ", "a_"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
450 call add(tl, [2, '^a.', "b a \na_"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
451 call add(tl, [2, '.a$', " a\n "]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
452 call add(tl, [2, '.a$', " a b\n_a", "_a"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
453 call add(tl, [2, '\%^a.', "a a\na", "a "]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
454 call add(tl, [2, '\%^a', " a \na "]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
455 call add(tl, [2, '.a\%$', " a\n "]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
456 call add(tl, [2, '.a\%$', " a\n_a", "_a"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
457 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
458 " Test recognition of character classes |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
459 call add(tl, [2, '[0-7]\+', 'x0123456789x', '01234567']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
460 call add(tl, [2, '[^0-7]\+', '0a;X+% 897', 'a;X+% 89']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
461 call add(tl, [2, '[0-9]\+', 'x0123456789x', '0123456789']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
462 call add(tl, [2, '[^0-9]\+', '0a;X+% 9', 'a;X+% ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
463 call add(tl, [2, '[0-9a-fA-F]\+', 'x0189abcdefg', '0189abcdef']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
464 call add(tl, [2, '[^0-9A-Fa-f]\+', '0189g;X+% ab', 'g;X+% ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
465 call add(tl, [2, '[a-z_A-Z0-9]\+', ';+aso_SfOij ', 'aso_SfOij']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
466 call add(tl, [2, '[^a-z_A-Z0-9]\+', 'aSo_;+% sfOij', ';+% ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
467 call add(tl, [2, '[a-z_A-Z]\+', '0abyz_ABYZ;', 'abyz_ABYZ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
468 call add(tl, [2, '[^a-z_A-Z]\+', 'abAB_09;+% yzYZ', '09;+% ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
469 call add(tl, [2, '[a-z]\+', '0abcxyz1', 'abcxyz']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
470 call add(tl, [2, '[a-z]\+', 'AabxyzZ', 'abxyz']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
471 call add(tl, [2, '[^a-z]\+', 'a;X09+% x', ';X09+% ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
472 call add(tl, [2, '[^a-z]\+', 'abX0;%yz', 'X0;%']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
473 call add(tl, [2, '[a-zA-Z]\+', '0abABxzXZ9', 'abABxzXZ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
474 call add(tl, [2, '[^a-zA-Z]\+', 'ab09_;+ XZ', '09_;+ ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
475 call add(tl, [2, '[A-Z]\+', 'aABXYZz', 'ABXYZ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
476 call add(tl, [2, '[^A-Z]\+', 'ABx0;%YZ', 'x0;%']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
477 call add(tl, [2, '[a-z]\+\c', '0abxyzABXYZ;', 'abxyzABXYZ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
478 call add(tl, [2, '[A-Z]\+\c', '0abABxzXZ9', 'abABxzXZ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
479 call add(tl, [2, '\c[^a-z]\+', 'ab09_;+ XZ', '09_;+ ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
480 call add(tl, [2, '\c[^A-Z]\+', 'ab09_;+ XZ', '09_;+ ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
481 call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
482 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
483 " Tests for \z features |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
484 " match ends at \ze |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
485 call add(tl, [2, 'xx \ze test', 'xx ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
486 call add(tl, [2, 'abc\zeend', 'oij abcend', 'abc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
487 call add(tl, [2, 'aa\zebb\|aaxx', ' aabb ', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
488 call add(tl, [2, 'aa\zebb\|aaxx', ' aaxx ', 'aaxx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
489 call add(tl, [2, 'aabb\|aa\zebb', ' aabb ', 'aabb']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
490 call add(tl, [2, 'aa\zebb\|aaebb', ' aabb ', 'aa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
491 " match starts at \zs |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
492 call add(tl, [2, 'abc\zsdd', 'ddabcddxyzt', 'dd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
493 call add(tl, [2, 'aa \zsax', ' ax']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
494 call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
495 call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
496 call add(tl, [2, '\>\zs.', 'aword. ', '.']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
497 call add(tl, [2, '\s\+\ze\[/\|\s\zs\s\+', 'is [a t', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
498 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
499 " Tests for \@= and \& features |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
500 call add(tl, [2, 'abc\@=', 'abc', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
501 call add(tl, [2, 'abc\@=cd', 'abcd', 'abcd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
502 call add(tl, [2, 'abc\@=', 'ababc', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
503 " will never match, no matter the input text |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
504 call add(tl, [2, 'abcd\@=e', 'abcd']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
505 " will never match |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
506 call add(tl, [2, 'abcd\@=e', 'any text in here ... ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
507 call add(tl, [2, '\v(abc)@=..', 'xabcd', 'ab', 'abc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
508 call add(tl, [2, '\(.*John\)\@=.*Bob', 'here is John, and here is B']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
509 call add(tl, [2, '\(John.*\)\@=.*Bob', 'John is Bobs friend', 'John is Bob', 'John is Bobs friend']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
510 call add(tl, [2, '\<\S\+\())\)\@=', '$((i=i+1))', 'i=i+1', '))']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
511 call add(tl, [2, '.*John\&.*Bob', 'here is John, and here is B']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
512 call add(tl, [2, '.*John\&.*Bob', 'John is Bobs friend', 'John is Bob']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
513 call add(tl, [2, '\v(test1)@=.*yep', 'this is a test1, yep it is', 'test1, yep', 'test1']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
514 call add(tl, [2, 'foo\(bar\)\@!', 'foobar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
515 call add(tl, [2, 'foo\(bar\)\@!', 'foo bar', 'foo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
516 call add(tl, [2, 'if \(\(then\)\@!.\)*$', ' if then else']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
517 call add(tl, [2, 'if \(\(then\)\@!.\)*$', ' if else ', 'if else ', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
518 call add(tl, [2, '\(foo\)\@!bar', 'foobar', 'bar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
519 call add(tl, [2, '\(foo\)\@!...bar', 'foobar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
520 call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' bar foo ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
521 call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
522 call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
523 call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
524 call add(tl, [2, '[ ]\@!\p\([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:', 's']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
525 call add(tl, [2, 'm\k\+_\@=\%(_\@!\k\)\@<=\k\+e', 'mx__xe', 'mx__xe']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
526 call add(tl, [2, '\%(\U\@<=S\k*\|S\l\)R', 'SuR', 'SuR']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
527 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
528 " Combining different tests and features |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
529 call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
530 call add(tl, [2, '', 'abcd', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
531 call add(tl, [2, '\v(())', 'any possible text', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
532 call add(tl, [2, '\v%(ab(xyz)c)', ' abxyzc ', 'abxyzc', 'xyz']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
533 call add(tl, [2, '\v(test|)empty', 'tesempty', 'empty', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
534 call add(tl, [2, '\v(a|aa)(a|aa)', 'aaa', 'aa', 'a', 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
535 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
536 " \%u and friends |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
537 call add(tl, [2, '\%d32', 'yes no', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
538 call add(tl, [2, '\%o40', 'yes no', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
539 call add(tl, [2, '\%x20', 'yes no', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
540 call add(tl, [2, '\%u0020', 'yes no', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
541 call add(tl, [2, '\%U00000020', 'yes no', ' ']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
542 call add(tl, [2, '\%d0', "yes\x0ano", "\x0a"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
543 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
544 "" \%[abc] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
545 call add(tl, [2, 'foo\%[bar]', 'fobar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
546 call add(tl, [2, 'foo\%[bar]', 'foobar', 'foobar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
547 call add(tl, [2, 'foo\%[bar]', 'fooxx', 'foo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
548 call add(tl, [2, 'foo\%[bar]', 'foobxx', 'foob']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
549 call add(tl, [2, 'foo\%[bar]', 'foobaxx', 'fooba']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
550 call add(tl, [2, 'foo\%[bar]', 'foobarxx', 'foobar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
551 call add(tl, [2, 'foo\%[bar]x', 'foobxx', 'foobx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
552 call add(tl, [2, 'foo\%[bar]x', 'foobarxx', 'foobarx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
553 call add(tl, [2, '\%[bar]x', 'barxx', 'barx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
554 call add(tl, [2, '\%[bar]x', 'bxx', 'bx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
555 call add(tl, [2, '\%[bar]x', 'xxx', 'x']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
556 call add(tl, [2, 'b\%[[ao]r]', 'bar bor', 'bar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
557 call add(tl, [2, 'b\%[[]]r]', 'b]r bor', 'b]r']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
558 call add(tl, [2, '@\%[\w\-]*', '<http://john.net/pandoc/>[@pandoc]', '@pandoc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
559 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
560 " Alternatives, must use first longest match |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
561 call add(tl, [2, 'goo\|go', 'google', 'goo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
562 call add(tl, [2, '\<goo\|\<go', 'google', 'goo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
563 call add(tl, [2, '\<goo\|go', 'google', 'goo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
564 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
565 " Back references |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
566 call add(tl, [2, '\(\i\+\) \1', ' abc abc', 'abc abc', 'abc']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
567 call add(tl, [2, '\(\i\+\) \1', 'xgoo goox', 'goo goo', 'goo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
568 call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
569 call add(tl, [2, '\(\d*\)a \1b', ' a b ', 'a b', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
570 call add(tl, [2, '^.\(.\).\_..\1.', "aaa\naaa\nb", "aaa\naaa", 'a']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
571 call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<!$', 'foo.bat/foo.com', 'foo.bat/foo.com', 'bat']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
572 call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<!$', 'foo.bat/foo.bat']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
573 call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<=$', 'foo.bat/foo.bat', 'foo.bat/foo.bat', 'bat', 'bat']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
574 call add(tl, [2, '\\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}', '2013-06-27${0}', '${0}', '0']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
575 call add(tl, [2, '^\(a*\)\1$', 'aaaaaaaa', 'aaaaaaaa', 'aaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
576 call add(tl, [2, '^\(a\{-2,}\)\1\+$', 'aaaaaaaaa', 'aaaaaaaaa', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
577 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
578 " Look-behind with limit |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
579 call add(tl, [2, '<\@<=span.', 'xxspanxx<spanyyy', 'spany']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
580 call add(tl, [2, '<\@1<=span.', 'xxspanxx<spanyyy', 'spany']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
581 call add(tl, [2, '<\@2<=span.', 'xxspanxx<spanyyy', 'spany']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
582 call add(tl, [2, '\(<<\)\@<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
583 call add(tl, [2, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
584 call add(tl, [2, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
585 call add(tl, [2, '\(foo\)\@<!bar.', 'xx foobar1 xbar2 xx', 'bar2']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
586 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
587 " look-behind match in front of a zero-width item |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
588 call add(tl, [2, '\v\C%(<Last Changed:\s+)@<=.*$', '" test header']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
589 call add(tl, [2, '\v\C%(<Last Changed:\s+)@<=.*$', '" Last Changed: 1970', '1970']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
590 call add(tl, [2, '\(foo\)\@<=\>', 'foobar']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
591 call add(tl, [2, '\(foo\)\@<=\>', 'barfoo', '', 'foo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
592 call add(tl, [2, '\(foo\)\@<=.*', 'foobar', 'bar', 'foo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
593 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
594 " complicated look-behind match |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
595 call add(tl, [2, '\(r\@<=\|\w\@<!\)\/', 'x = /word/;', '/']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
596 call add(tl, [2, '^[a-z]\+\ze \&\(asdf\)\@<!', 'foo bar', 'foo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
597 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
598 "" \@> |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
599 call add(tl, [2, '\(a*\)\@>a', 'aaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
600 call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
601 call add(tl, [2, '^\(.\{-}b\)\@>.', ' abcbd', ' abc', ' ab']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
602 call add(tl, [2, '\(.\{-}\)\(\)\@>$', 'abc', 'abc', 'abc', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
603 " TODO: BT engine does not restore submatch after failure |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
604 call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
605 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
606 " "\_" prepended negated collection matches EOL |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
607 call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
608 call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
609 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
610 " Requiring lots of states. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
611 call add(tl, [2, '[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}', " 12345678-1234-1234-1234-123456789012 ", "12345678-1234-1234-1234-123456789012", "1234-"]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
612 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
613 " Skip adding state twice |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
614 call add(tl, [2, '^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=', "#if FOO", "#if", ' FOO']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
615 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
616 " Test \%V atom |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
617 call add(tl, [2, '\%>70vGesamt', 'Jean-Michel Charlier & Victor Hubinon\Gesamtausgabe [Salleck] Buck Danny {Jean-Michel Charlier & Victor Hubinon}\Gesamtausgabe', 'Gesamt']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
618 |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
619 " Test for ignoring case and matching repeated characters |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
620 call add(tl, [2, '\cb\+', 'aAbBbBcC', 'bBbB']) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
621 |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
622 " Run the tests |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
623 for t in tl |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
624 let re = t[0] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
625 let pat = t[1] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
626 let text = t[2] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
627 let matchidx = 3 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
628 for engine in [0, 1, 2] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
629 if engine == 2 && re == 0 || engine == 1 && re == 1 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
630 continue |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
631 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
632 let ®expengine = engine |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
633 try |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
634 let l = matchlist(text, pat) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
635 catch |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
636 call assert_report('Error ' . engine . ': pat: \"' . pat |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
637 \ . '\", text: \"' . text . '\", caused an exception: \"' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
638 \ . v:exception . '\"') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
639 endtry |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
640 " check the match itself |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
641 if len(l) == 0 && len(t) > matchidx |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
642 call assert_report('Error ' . engine . ': pat: \"' . pat |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
643 \ . '\", text: \"' . text . '\", did not match, expected: \"' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
644 \ . t[matchidx] . '\"') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
645 elseif len(l) > 0 && len(t) == matchidx |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
646 call assert_report('Error ' . engine . ': pat: \"' . pat |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
647 \ . '\", text: \"' . text . '\", match: \"' . l[0] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
648 \ . '\", expected no match') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
649 elseif len(t) > matchidx && l[0] != t[matchidx] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
650 call assert_report('Error ' . engine . ': pat: \"' . pat |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
651 \ . '\", text: \"' . text . '\", match: \"' . l[0] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
652 \ . '\", expected: \"' . t[matchidx] . '\"') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
653 else |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
654 " Test passed |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
655 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
656 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
657 " check all the nine submatches |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
658 if len(l) > 0 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
659 for i in range(1, 9) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
660 if len(t) <= matchidx + i |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
661 let e = '' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
662 else |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
663 let e = t[matchidx + i] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
664 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
665 if l[i] != e |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
666 call assert_report('Error ' . engine . ': pat: \"' . pat |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
667 \ . '\", text: \"' . text . '\", submatch ' . i . ': \"' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
668 \ . l[i] . '\", expected: \"' . e . '\"') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
669 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
670 endfor |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
671 unlet i |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
672 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
673 endfor |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
674 endfor |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
675 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
676 unlet t tl e l |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
677 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
678 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
679 " Tests for multi-line regexp patterns without multi-byte support. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
680 func Test_regexp_multiline_pat() |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
681 " tl is a List of Lists with: |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
682 " regexp engines to test |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
683 " 0 - test with 'regexpengine' values 0 and 1 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
684 " 1 - test with 'regexpengine' values 0 and 2 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
685 " 2 - test with 'regexpengine' values 0, 1 and 2 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
686 " regexp pattern |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
687 " List with text to test the pattern on |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
688 " List with the expected match |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
689 let tl = [] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
690 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
691 " back references |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
692 call add(tl, [2, '^.\(.\).\_..\1.', ['aaa', 'aaa', 'b'], ['XX', 'b']]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
693 call add(tl, [2, '\v.*\/(.*)\n.*\/\1$', ['./Dir1/Dir2/zyxwvuts.txt', './Dir1/Dir2/abcdefgh.bat', '', './Dir1/Dir2/file1.txt', './OtherDir1/OtherDir2/file1.txt'], ['./Dir1/Dir2/zyxwvuts.txt', './Dir1/Dir2/abcdefgh.bat', '', 'XX']]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
694 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
695 " line breaks |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
696 call add(tl, [2, '\S.*\nx', ['abc', 'def', 'ghi', 'xjk', 'lmn'], ['abc', 'def', 'XXjk', 'lmn']]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
697 |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
698 " Any single character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
699 call add(tl, [2, '\_.\+', ['a', 'b', 'c'], ['XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
700 " Any identifier or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
701 call add(tl, [2, '\_i\+', ['a', 'b', ';', '2'], ['XX;XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
702 " Any identifier but excluding digits or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
703 call add(tl, [2, '\_I\+', ['a', 'b', ';', '2'], ['XX;XX2XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
704 " Any keyword or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
705 call add(tl, [2, '\_k\+', ['a', 'b', '=', '2'], ['XX=XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
706 " Any keyword but excluding digits or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
707 call add(tl, [2, '\_K\+', ['a', 'b', '=', '2'], ['XX=XX2XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
708 " Any filename character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
709 call add(tl, [2, '\_f\+', ['a', 'b', '.', '5'], ['XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
710 " Any filename character but excluding digits or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
711 call add(tl, [2, '\_F\+', ['a', 'b', '.', '5'], ['XX5XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
712 " Any printable character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
713 call add(tl, [2, '\_p\+', ['a', 'b', '=', '4'], ['XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
714 " Any printable character excluding digits or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
715 call add(tl, [2, '\_P\+', ['a', 'b', '=', '4'], ['XX4XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
716 " Any whitespace character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
717 call add(tl, [2, '\_s\+', [' ', ' ', 'a', 'b'], ['XXaXXbXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
718 " Any non-whitespace character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
719 call add(tl, [2, '\_S\+', [' ', ' ', 'a', 'b'], [' XX XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
720 " Any decimal digit or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
721 call add(tl, [2, '\_d\+', ['1', 'a', '2', 'b', '3'], ['XXaXXbXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
722 " Any non-decimal digit or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
723 call add(tl, [2, '\_D\+', ['1', 'a', '2', 'b', '3'], ['1XX2XX3XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
724 " Any hexadecimal digit or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
725 call add(tl, [2, '\_x\+', ['1', 'a', 'g', '9', '8'], ['XXgXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
726 " Any non-hexadecimal digit or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
727 call add(tl, [2, '\_X\+', ['1', 'a', 'g', '9', '8'], ['1XXaXX9XX8XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
728 " Any octal digit or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
729 call add(tl, [2, '\_o\+', ['0', '7', '8', '9', '0'], ['XX8XX9XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
730 " Any non-octal digit or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
731 call add(tl, [2, '\_O\+', ['0', '7', '8', '9', '0'], ['0XX7XX0XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
732 " Any word character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
733 call add(tl, [2, '\_w\+', ['A', 'B', '=', 'C', 'D'], ['XX=XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
734 " Any non-word character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
735 call add(tl, [2, '\_W\+', ['A', 'B', '=', 'C', 'D'], ['AXXBXXCXXDXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
736 " Any head-of-word character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
737 call add(tl, [2, '\_h\+', ['a', '1', 'b', '2', 'c'], ['XX1XX2XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
738 " Any non-head-of-word character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
739 call add(tl, [2, '\_H\+', ['a', '1', 'b', '2', 'c'], ['aXXbXXcXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
740 " Any alphabetic character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
741 call add(tl, [2, '\_a\+', ['a', '1', 'b', '2', 'c'], ['XX1XX2XX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
742 " Any non-alphabetic character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
743 call add(tl, [2, '\_A\+', ['a', '1', 'b', '2', 'c'], ['aXXbXXcXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
744 " Any lowercase character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
745 call add(tl, [2, '\_l\+', ['a', 'A', 'b', 'B'], ['XXAXXBXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
746 " Any non-lowercase character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
747 call add(tl, [2, '\_L\+', ['a', 'A', 'b', 'B'], ['aXXbXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
748 " Any uppercase character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
749 call add(tl, [2, '\_u\+', ['a', 'A', 'b', 'B'], ['aXXbXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
750 " Any non-uppercase character or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
751 call add(tl, [2, '\_U\+', ['a', 'A', 'b', 'B'], ['XXAXXBXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
752 " Collection or end-of-line |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
753 call add(tl, [2, '\_[a-z]\+', ['a', 'A', 'b', 'B'], ['XXAXXBXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
754 " start of line anywhere in the text |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
755 call add(tl, [2, 'one\zs\_s*\_^\zetwo', |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
756 \ ['', 'one', ' two', 'one', '', 'two'], |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
757 \ ['', 'one', ' two', 'oneXXtwo']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
758 " end of line anywhere in the text |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
759 call add(tl, [2, 'one\zs\_$\_s*two', |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
760 \ ['', 'one', ' two', 'one', '', 'two'], ['', 'oneXX', 'oneXX']]) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
761 |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
762 " Check that \_[0-9] matching EOL does not break a following \> |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
763 call add(tl, [2, '\<\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{3\}\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\>', ['', 'localnet/192.168.0.1', ''], ['', 'localnet/XX', '']]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
764 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
765 " Check a pattern with a line break and ^ and $ |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
766 call add(tl, [2, 'a\n^b$\n^c', ['a', 'b', 'c'], ['XX']]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
767 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
768 call add(tl, [2, '\(^.\+\n\)\1', [' dog', ' dog', 'asdf'], ['XXasdf']]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
769 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
770 " Run the multi-line tests |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
771 for t in tl |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
772 let re = t[0] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
773 let pat = t[1] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
774 let before = t[2] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
775 let after = t[3] |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
776 for engine in [0, 1, 2] |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
777 if engine == 2 && re == 0 || engine == 1 && re == 1 |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
778 continue |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
779 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
780 let ®expengine = engine |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
781 new |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
782 call setline(1, before) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
783 exe '%s/' . pat . '/XX/' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
784 let result = getline(1, '$') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
785 q! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
786 if result != after |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
787 call assert_report('Error: pat: \"' . pat . '\", text: \"' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
788 \ . string(before) . '\", expected: \"' . string(after) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
789 \ . '\", got: \"' . string(result) . '\"') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
790 else |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
791 " Test passed |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
792 endif |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
793 endfor |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
794 endfor |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
795 unlet t tl |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
796 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
797 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
798 " Check that using a pattern on two lines doesn't get messed up by using |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
799 " matchstr() with \ze in between. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
800 func Test_matchstr_with_ze() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
801 new |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
802 call append(0, ['Substitute here:', '<T="">Ta 5</Title>', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
803 \ '<T="">Ac 7</Title>']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
804 call cursor(1, 1) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
805 set re=0 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
806 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
807 .+1,.+2s/""/\='"' . matchstr(getline("."), '\d\+\ze<') . '"' |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
808 call assert_equal(['Substitute here:', '<T="5">Ta 5</Title>', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
809 \ '<T="7">Ac 7</Title>', ''], getline(1, '$')) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
810 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
811 bwipe! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
812 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
813 |
28171
b4c111ea83b1
patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents:
26907
diff
changeset
|
814 " Check a pattern with a look behind crossing a line boundary |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
815 func Test_lookbehind_across_line() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
816 new |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
817 call append(0, ['Behind:', 'asdfasd<yyy', 'xxstart1', 'asdfasd<yy', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
818 \ 'xxxstart2', 'asdfasd<yy', 'xxstart3']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
819 call cursor(1, 1) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
820 call search('\(<\_[xy]\+\)\@3<=start') |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
821 call assert_equal([0, 7, 3, 0], getpos('.')) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
822 bwipe! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
823 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
824 |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
825 " Test for the \%V atom (match inside the visual area) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
826 func Regex_Match_Visual_Area() |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
827 call append(0, ['Visual:', 'thexe the thexethe', 'andaxand andaxand', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
828 \ 'oooxofor foroxooo', 'oooxofor foroxooo']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
829 call cursor(1, 1) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
830 exe "normal jfxvfx:s/\\%Ve/E/g\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
831 exe "normal jV:s/\\%Va/A/g\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
832 exe "normal jfx\<C-V>fxj:s/\\%Vo/O/g\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
833 call assert_equal(['Visual:', 'thexE thE thExethe', 'AndAxAnd AndAxAnd', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
834 \ 'oooxOfOr fOrOxooo', 'oooxOfOr fOrOxooo', ''], getline(1, '$')) |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
835 %d |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
836 endfunc |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
837 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
838 " Check matching Visual area |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
839 func Test_matching_visual_area() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
840 new |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
841 set regexpengine=1 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
842 call Regex_Match_Visual_Area() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
843 set regexpengine=2 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
844 call Regex_Match_Visual_Area() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
845 set regexpengine& |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
846 bwipe! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
847 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
848 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
849 " Check matching marks |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
850 func Regex_Mark() |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
851 call append(0, ['', '', '', 'Marks:', 'asdfSasdfsadfEasdf', 'asdfSas', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
852 \ 'dfsadfEasdf', '', '', '', '', '']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
853 call cursor(4, 1) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
854 exe "normal jfSmsfEme:.-4,.+6s/.\\%>'s.*\\%<'e../here/\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
855 exe "normal jfSmsj0fEme:.-4,.+6s/.\\%>'s\\_.*\\%<'e../again/\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
856 call assert_equal(['', '', '', 'Marks:', 'asdfhereasdf', 'asdfagainasdf', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
857 \ '', '', '', '', '', ''], getline(1, '$')) |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
858 %d |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
859 endfunc |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
860 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
861 func Test_matching_marks() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
862 new |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
863 set regexpengine=1 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
864 call Regex_Mark() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
865 set regexpengine=2 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
866 call Regex_Mark() |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
867 bwipe! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
868 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
869 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
870 " Check patterns matching cursor position. |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
871 func s:curpos_test() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
872 new |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
873 call setline(1, ['ffooooo', 'boboooo', 'zoooooo', 'koooooo', 'moooooo', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
874 \ "\t\t\tfoo", 'abababababababfoo', 'bababababababafoo', '********_', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
875 \ ' xxxxxxxxxxxx xxxx xxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxx xxxxx xxxxxxx xx xxxx xxxxxxxx xxxx xxxxxxxxxxx xxx xxxxxxx xxxxxxxxx xx xxxxxx xx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxx xxxx xxx xxxx xxx xxx xxxxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxxx xx xxxxx xxx xxxxxxxx xxxxxx xxx xxx xxxxxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx xxx xxx xxxxxxxx xxxxxxx xxxx xxx xxxxxx xxxxx xxxxx xx xxxxxx xxxxxxx xxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxx xxxxxx xxxxx xxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xxxx xx xxxxxxxx xxx xxxxxxxxxxx xxxxx']) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
876 call setpos('.', [0, 1, 0, 0]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
877 s/\%>3c.//g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
878 call setpos('.', [0, 2, 4, 0]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
879 s/\%#.*$//g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
880 call setpos('.', [0, 3, 0, 0]) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
881 s/\%<3c./_/g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
882 %s/\%4l\%>5c./_/g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
883 %s/\%6l\%>25v./_/g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
884 %s/\%>6l\%3c./!/g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
885 %s/\%>7l\%12c./?/g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
886 %s/\%>7l\%<9l\%>5v\%<8v./#/g |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
887 $s/\%(|\u.*\)\@<=[^|\t]\+$//ge |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
888 call assert_equal(['ffo', 'bob', '__ooooo', 'koooo__', 'moooooo', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
889 \ ' f__', 'ab!babababababfoo', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
890 \ 'ba!ab##abab?bafoo', '**!*****_', |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
891 \ ' ! xxx?xxxxxxxx xxxx xxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxx xxxxx xxxxxxx xx xxxx xxxxxxxx xxxx xxxxxxxxxxx xxx xxxxxxx xxxxxxxxx xx xxxxxx xx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxx xxxxxxxx xxxxxxxxx xxxx xxx xxxx xxx xxx xxxxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxxxxxxx xx xxxxx xxx xxxxxxxx xxxxxx xxx xxx xxxxxxxxx xxxxxxx x xxxxxxxxx xx xxxxxx xxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxx xxxxxxx xxx xxx xxxxxxxx xxxxxxx xxxx xxx xxxxxx xxxxx xxxxx xx xxxxxx xxxxxxx xxx xxxxxxxxxxxx xxxx xxxxxxxxx xxxxxx xxxxxx xxxxx xxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxx xxxx xx xxxxxxxx xxx xxxxxxxxxxx xxxxx'], |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
892 \ getline(1, '$')) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
893 bwipe! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
894 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
895 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
896 func Test_matching_curpos() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
897 set re=0 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
898 call s:curpos_test() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
899 set re=1 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
900 call s:curpos_test() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
901 set re=2 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
902 call s:curpos_test() |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
903 set re& |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
904 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
905 |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
906 " Test for matching the start and end of a buffer |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
907 func Regex_start_end_buffer() |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
908 call setline(1, repeat(['vim edit'], 20)) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
909 /\%^ |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
910 call assert_equal([0, 1, 1, 0], getpos('.')) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
911 exe "normal 50%/\\%^..\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
912 call assert_equal([0, 1, 1, 0], getpos('.')) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
913 exe "normal 50%/\\%$\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
914 call assert_equal([0, 20, 8, 0], getpos('.')) |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
915 exe "normal 6gg/..\\%$\<CR>" |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
916 call assert_equal([0, 20, 7, 0], getpos('.')) |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
917 %d |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
918 endfunc |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
919 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
920 func Test_start_end_of_buffer_match() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
921 new |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
922 set regexpengine=1 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
923 call Regex_start_end_buffer() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
924 set regexpengine=2 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
925 call Regex_start_end_buffer() |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
926 bwipe! |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
927 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
928 |
23150
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
929 func Test_ze_before_zs() |
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
930 call assert_equal('', matchstr(' ', '\%#=1\ze \zs')) |
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
931 call assert_equal('', matchstr(' ', '\%#=2\ze \zs')) |
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
932 call assert_equal(repeat([''], 10), matchlist(' ', '\%#=1\ze \zs')) |
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
933 call assert_equal(repeat([''], 10), matchlist(' ', '\%#=2\ze \zs')) |
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
934 endfunc |
90b16a0022e5
patch 8.2.2121: internal error when using ze before zs in a pattern
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
935 |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
936 " Check for detecting error |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
937 func Test_regexp_error() |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
938 call assert_fails("call matchlist('x x', '\\%#=1 \\zs*')", 'E888:') |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
939 call assert_fails("call matchlist('x x', '\\%#=1 \\ze*')", 'E888:') |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
940 call assert_fails("call matchlist('x x', '\\%#=2 \\zs*')", 'E888:') |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
941 call assert_fails("call matchlist('x x', '\\%#=2 \\ze*')", 'E888:') |
19969
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19958
diff
changeset
|
942 call assert_fails("call matchstr('abcd', '\\%o841\\%o142')", 'E678:') |
24230
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
943 call assert_fails("call matchstr('abcd', '\\%#=2\\%2147483647c')", 'E951:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
944 call assert_fails("call matchstr('abcd', '\\%#=2\\%2147483647l')", 'E951:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
945 call assert_fails("call matchstr('abcd', '\\%#=2\\%2147483647v')", 'E951:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
946 call assert_fails('exe "normal /\\%#=1\\%[x\\%[x]]\<CR>"', 'E369:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
947 call assert_fails('exe "normal /\\%#=2\\%2147483647l\<CR>"', 'E951:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
948 call assert_fails('exe "normal /\\%#=2\\%2147483647c\<CR>"', 'E951:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
949 call assert_fails('exe "normal /\\%#=2\\%102261126v\<CR>"', 'E951:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
950 call assert_fails('exe "normal /\\%#=2\\%2147483646l\<CR>"', 'E486:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
951 call assert_fails('exe "normal /\\%#=2\\%2147483646c\<CR>"', 'E486:') |
ed0fc4787392
patch 8.2.2656: some command line arguments and regexp errors not tested
Bram Moolenaar <Bram@vim.org>
parents:
23150
diff
changeset
|
952 call assert_fails('exe "normal /\\%#=2\\%102261125v\<CR>"', 'E486:') |
19969
b07672d13ff9
patch 8.2.0540: regexp and other code not tested
Bram Moolenaar <Bram@vim.org>
parents:
19958
diff
changeset
|
953 call assert_equal('', matchstr('abcd', '\%o181\%o142')) |
19958
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
954 endfunc |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
955 |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
956 " Test for using the last substitute string pattern (~) |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
957 func Test_regexp_last_subst_string() |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
958 new |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
959 s/bar/baz/e |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
960 call assert_equal(matchstr("foo\nbaz\nbar", "\\%#=1\~"), "baz") |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
961 call assert_equal(matchstr("foo\nbaz\nbar", "\\%#=2\~"), "baz") |
0b42b5e50344
patch 8.2.0535: regexp patterns not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
962 close! |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
963 endfunc |
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
964 |
25147
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
965 " Check patterns matching cursor position. |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
966 func s:curpos_test2() |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
967 new |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
968 call setline(1, ['1', '2 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
969 \ '3 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
970 \ '4 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
971 \ '5 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
972 \ '6 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
973 \ '7 foobar eins zwei drei vier fünf sechse']) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
974 call setpos('.', [0, 2, 10, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
975 s/\%.c.*//g |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
976 call setpos('.', [0, 3, 15, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
977 s/\%.l.*//g |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
978 call setpos('.', [0, 5, 3, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
979 s/\%.v.*/_/g |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
980 call assert_equal(['1', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
981 \ '2 foobar ', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
982 \ '', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
983 \ '4 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
984 \ '5 _', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
985 \ '6 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
986 \ '7 foobar eins zwei drei vier fünf sechse'], |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
987 \ getline(1, '$')) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
988 call assert_fails('call search("\\%.1l")', 'E1204:') |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
989 call assert_fails('call search("\\%.1c")', 'E1204:') |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
990 call assert_fails('call search("\\%.1v")', 'E1204:') |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
991 bwipe! |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
992 endfunc |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
993 |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
994 " Check patterns matching before or after cursor position. |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
995 func s:curpos_test3() |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
996 new |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
997 call setline(1, ['1', '2 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
998 \ '3 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
999 \ '4 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1000 \ '5 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1001 \ '6 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1002 \ '7 foobar eins zwei drei vier fünf sechse']) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1003 call setpos('.', [0, 2, 10, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1004 " Note: This removes all columns, except for the column directly in front of |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1005 " the cursor. Bug???? |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1006 :s/^.*\%<.c// |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1007 call setpos('.', [0, 3, 10, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1008 :s/\%>.c.*$// |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1009 call setpos('.', [0, 5, 4, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1010 " Note: This removes all columns, except for the column directly in front of |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1011 " the cursor. Bug???? |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1012 :s/^.*\%<.v/_/ |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1013 call setpos('.', [0, 6, 4, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1014 :s/\%>.v.*$/_/ |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1015 call assert_equal(['1', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1016 \ ' eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1017 \ '3 foobar e', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1018 \ '4 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1019 \ '_foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1020 \ '6 fo_', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1021 \ '7 foobar eins zwei drei vier fünf sechse'], |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1022 \ getline(1, '$')) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1023 sil %d |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1024 call setline(1, ['1', '2 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1025 \ '3 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1026 \ '4 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1027 \ '5 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1028 \ '6 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1029 \ '7 foobar eins zwei drei vier fünf sechse']) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1030 call setpos('.', [0, 4, 4, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1031 %s/\%<.l.*// |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1032 call setpos('.', [0, 5, 4, 0]) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1033 %s/\%>.l.*// |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1034 call assert_equal(['', '', '', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1035 \ '4 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1036 \ '5 foobar eins zwei drei vier fünf sechse', |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1037 \ '', ''], |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1038 \ getline(1, '$')) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1039 bwipe! |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1040 endfunc |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1041 |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1042 " Test that matching below, at or after the |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1043 " cursor position work |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1044 func Test_matching_pos() |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1045 for val in range(3) |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1046 exe "set re=" .. val |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1047 " Match at cursor position |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1048 call s:curpos_test2() |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1049 " Match before or after cursor position |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1050 call s:curpos_test3() |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1051 endfor |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1052 set re& |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1053 endfunc |
10b269321459
patch 8.2.3110: a pattern that matches the cursor position is complicated
Bram Moolenaar <Bram@vim.org>
parents:
24230
diff
changeset
|
1054 |
26161
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1055 func Test_using_mark_position() |
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1056 " this was using freed memory |
28240
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1057 " new engine |
26161
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1058 new |
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1059 norm O0 |
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1060 call assert_fails("s/\\%')", 'E486:') |
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1061 bwipe! |
28240
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1062 |
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1063 " old engine |
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1064 new |
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1065 norm O0 |
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1066 call assert_fails("s/\\%#=1\\%')", 'E486:') |
692f6a861c47
patch 8.2.4646: using buffer line after it has been freed
Bram Moolenaar <Bram@vim.org>
parents:
28171
diff
changeset
|
1067 bwipe! |
26161
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1068 endfunc |
9835f424bef5
patch 8.2.3612: using freed memory with regexp using a mark
Bram Moolenaar <Bram@vim.org>
parents:
25147
diff
changeset
|
1069 |
26841
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1070 func Test_using_visual_position() |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1071 " this was using freed memory |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1072 new |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1073 exe "norm 0o\<Esc>\<C-V>k\<C-X>o0" |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1074 /\%V |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1075 bwipe! |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1076 endfunc |
48d6f187e9c0
patch 8.2.3949: using freed memory with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26161
diff
changeset
|
1077 |
26843
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1078 func Test_using_invalid_visual_position() |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1079 " this was going beyond the end of the line |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1080 new |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1081 exe "norm 0o000\<Esc>0\<C-V>$s0" |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1082 /\%V |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1083 bwipe! |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1084 endfunc |
1e3c49c09260
patch 8.2.3950: going beyond the end of the line with /%V
Bram Moolenaar <Bram@vim.org>
parents:
26841
diff
changeset
|
1085 |
18898
ad9e9e92ad55
patch 8.2.0010: test64 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15904
diff
changeset
|
1086 " vim: shiftwidth=2 sts=2 expandtab |