Skip to content

Commit 22e4215

Browse files
committed
patch 7.4.1700
Problem: Equivalence classes are not properly tested. Solution: Add tests for multi-byte and latin1. Fix an error. (Owen Leibman)
1 parent 71fb0c1 commit 22e4215

7 files changed

Lines changed: 87 additions & 2 deletions

File tree

src/regexp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,15 +791,15 @@ char *EQUIVAL_CLASS_C[16] = {
791791
"E\x71\x72\x73\x74",
792792
"I\x75\x76\x77\x78",
793793
"N\x69",
794-
"O\xEB\xEC\xED\xEE\xEF",
794+
"O\xEB\xEC\xED\xEE\xEF\x80",
795795
"U\xFB\xFC\xFD\xFE",
796796
"Y\xBA",
797797
"a\x42\x43\x44\x45\x46\x47",
798798
"c\x48",
799799
"e\x51\x52\x53\x54",
800800
"i\x55\x56\x57\x58",
801801
"n\x49",
802-
"o\xCB\xCC\xCD\xCE\xCF",
802+
"o\xCB\xCC\xCD\xCE\xCF\x70",
803803
"u\xDB\xDC\xDD\xDE",
804804
"y\x8D\xDF",
805805
};

src/testdir/Make_all.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ NEW_TESTS = test_arglist.res \
183183
test_viml.res \
184184
test_visual.res \
185185
test_window_id.res \
186+
test_alot_latin.res \
187+
test_alot_utf8.res \
186188
test_alot.res
187189

188190

src/testdir/test_alot_latin.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
" A series of tests that can run in one Vim invocation.
2+
" This makes testing go faster, since Vim doesn't need to restart.
3+
4+
" These tests use latin1 'encoding'. Setting 'encoding' is in the individual
5+
" files, so that they can be run by themselves.
6+
7+
source test_regexp_latin.vim

src/testdir/test_alot_utf8.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
" A series of tests that can run in one Vim invocation.
2+
" This makes testing go faster, since Vim doesn't need to restart.
3+
4+
" These tests use utf8 'encoding'. Setting 'encoding' is in the individual
5+
" files, so that they can be run by themselves.
6+
7+
source test_regexp_utf8.vim

src/testdir/test_regexp_latin.vim

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
" Tests for regexp in latin1 encoding
2+
set encoding=latin1
3+
scriptencoding latin1
4+
5+
func s:equivalence_test()
6+
let str = "AÀÁÂÃÄÅ B C D EÈÉÊË F G H IÌÍÎÏ J K L M NÑ OÒÓÔÕÖØ P Q R S T UÙÚÛÜ V W X YÝ Z aàáâãäå b c d eèéêë f g h iìíîï j k l m nñ oòóôõöø p q r s t uùúûü v w x yýÿ z"
7+
let groups = split(str)
8+
for group1 in groups
9+
for c in split(group1, '\zs')
10+
" next statement confirms that equivalence class matches every
11+
" character in group
12+
call assert_match('^[[=' . c . '=]]*$', group1)
13+
for group2 in groups
14+
if group2 != group1
15+
" next statement converts that equivalence class doesn't match
16+
" a character in any other group
17+
call assert_equal(-1, match(group2, '[[=' . c . '=]]'))
18+
endif
19+
endfor
20+
endfor
21+
endfor
22+
endfunc
23+
24+
func Test_equivalence_re1()
25+
set re=1
26+
call s:equivalence_test()
27+
endfunc
28+
29+
func Test_equivalence_re2()
30+
set re=2
31+
call s:equivalence_test()
32+
endfunc

src/testdir/test_regexp_utf8.vim

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
" Tests for regexp in utf8 encoding
2+
if !has('multi_byte')
3+
finish
4+
endif
5+
set encoding=utf-8
6+
scriptencoding utf-8
7+
8+
func s:equivalence_test()
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ŹŻŽƵẐẔ aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ"
10+
let groups = split(str)
11+
for group1 in groups
12+
for c in split(group1, '\zs')
13+
" next statement confirms that equivalence class matches every
14+
" character in group
15+
call assert_match('^[[=' . c . '=]]*$', group1)
16+
for group2 in groups
17+
if group2 != group1
18+
" next statement converts that equivalence class doesn't match
19+
" character in any other group
20+
call assert_equal(-1, match(group2, '[[=' . c . '=]]'))
21+
endif
22+
endfor
23+
endfor
24+
endfor
25+
endfunc
26+
27+
func Test_equivalence_re1()
28+
set re=1
29+
call s:equivalence_test()
30+
endfunc
31+
32+
func Test_equivalence_re2()
33+
set re=2
34+
call s:equivalence_test()
35+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1700,
751753
/**/
752754
1699,
753755
/**/

0 commit comments

Comments
 (0)