Mercurial > vim
comparison src/testdir/test_regexp_utf8.vim @ 8995:3cf6704d6efc v7.4.1783
commit https://github.com/vim/vim/commit/af98a49dd0ef1661b4998f118151fddbf6e4df75
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 24 14:40:12 2016 +0200
patch 7.4.1783
Problem: The old regexp engine doesn't handle character classes correctly.
(Manuel Ortega)
Solution: Use regmbc() instead of regc(). Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Apr 2016 14:45:04 +0200 |
parents | 318eaa6fa973 |
children | f414db42d167 |
comparison
equal
deleted
inserted
replaced
8994:c48891ecfef2 | 8995:3cf6704d6efc |
---|---|
31 | 31 |
32 func Test_equivalence_re2() | 32 func Test_equivalence_re2() |
33 set re=2 | 33 set re=2 |
34 call s:equivalence_test() | 34 call s:equivalence_test() |
35 endfunc | 35 endfunc |
36 | |
37 func s:classes_test() | |
38 call assert_equal('Motörhead', matchstr('Motörhead', '[[:print:]]\+')) | |
39 | |
40 let alphachars = '' | |
41 let lowerchars = '' | |
42 let upperchars = '' | |
43 let alnumchars = '' | |
44 let printchars = '' | |
45 let punctchars = '' | |
46 let xdigitchars = '' | |
47 let i = 1 | |
48 while i <= 255 | |
49 let c = nr2char(i) | |
50 if c =~ '[[:alpha:]]' | |
51 let alphachars .= c | |
52 endif | |
53 if c =~ '[[:lower:]]' | |
54 let lowerchars .= c | |
55 endif | |
56 if c =~ '[[:upper:]]' | |
57 let upperchars .= c | |
58 endif | |
59 if c =~ '[[:alnum:]]' | |
60 let alnumchars .= c | |
61 endif | |
62 if c =~ '[[:print:]]' | |
63 let printchars .= c | |
64 endif | |
65 if c =~ '[[:punct:]]' | |
66 let punctchars .= c | |
67 endif | |
68 if c =~ '[[:xdigit:]]' | |
69 let xdigitchars .= c | |
70 endif | |
71 let i += 1 | |
72 endwhile | |
73 | |
74 call assert_equal('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alphachars) | |
75 call assert_equal('abcdefghijklmnopqrstuvwxyzµßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ', lowerchars) | |
76 call assert_equal('ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ', upperchars) | |
77 call assert_equal('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', alnumchars) | |
78 call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', printchars) | |
79 call assert_equal('!"#$%&''()*+,-./:;<=>?@[\]^_`{|}~', punctchars) | |
80 call assert_equal('0123456789ABCDEFabcdef', xdigitchars) | |
81 endfunc | |
82 | |
83 func Test_classes_re1() | |
84 set re=1 | |
85 call s:classes_test() | |
86 endfunc | |
87 | |
88 func Test_classes_re2() | |
89 set re=2 | |
90 call s:classes_test() | |
91 endfunc |