blob: ea3b2e73920b09c7cb7607fa05a18d1412e01157 [file] [log] [blame]
Bram Moolenaar22e42152016-04-03 14:02:02 +02001" Tests for regexp in latin1 encoding
2set encoding=latin1
3scriptencoding latin1
4
5func 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
22endfunc
23
24func Test_equivalence_re1()
25 set re=1
26 call s:equivalence_test()
27endfunc
28
29func Test_equivalence_re2()
30 set re=2
31 call s:equivalence_test()
32endfunc
Bram Moolenaarf5a39442016-08-16 21:04:41 +020033
34func Test_recursive_substitute()
35 new
36 s/^/\=execute("s#^##gn")
37 " check we are now not in the sandbox
38 call setwinvar(1, 'myvar', 1)
39 bwipe!
40endfunc
41