comparison src/testdir/test_regexp_latin.vim @ 8825:318eaa6fa973 v7.4.1700

commit https://github.com/vim/vim/commit/22e421549d54147d003f6444de007cb1d73f1d27 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 3 14:02:02 2016 +0200 patch 7.4.1700 Problem: Equivalence classes are not properly tested. Solution: Add tests for multi-byte and latin1. Fix an error. (Owen Leibman)
author Christian Brabandt <cb@256bit.org>
date Sun, 03 Apr 2016 14:15:05 +0200
parents
children 064effd222a3
comparison
equal deleted inserted replaced
8824:7b539c78d5e0 8825:318eaa6fa973
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