summaryrefslogtreecommitdiff
path: root/src/testdir/test_regexp_latin.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-04-03 14:02:02 +0200
committerBram Moolenaar <Bram@vim.org>2016-04-03 14:02:02 +0200
commit22e421549d54147d003f6444de007cb1d73f1d27 (patch)
tree901cec6c4b1a2e78966da581eac144063f234ad7 /src/testdir/test_regexp_latin.vim
parent71fb0c146bef08dc276fc5793bd47366e6e0f32a (diff)
downloadvim-22e421549d54147d003f6444de007cb1d73f1d27.zip
patch 7.4.1700
Problem: Equivalence classes are not properly tested. Solution: Add tests for multi-byte and latin1. Fix an error. (Owen Leibman)
Diffstat (limited to 'src/testdir/test_regexp_latin.vim')
-rw-r--r--src/testdir/test_regexp_latin.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
new file mode 100644
index 000000000..852841280
--- /dev/null
+++ b/src/testdir/test_regexp_latin.vim
@@ -0,0 +1,32 @@
+" Tests for regexp in latin1 encoding
+set encoding=latin1
+scriptencoding latin1
+
+func s:equivalence_test()
+ 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"
+ let groups = split(str)
+ for group1 in groups
+ for c in split(group1, '\zs')
+ " next statement confirms that equivalence class matches every
+ " character in group
+ call assert_match('^[[=' . c . '=]]*$', group1)
+ for group2 in groups
+ if group2 != group1
+ " next statement converts that equivalence class doesn't match
+ " a character in any other group
+ call assert_equal(-1, match(group2, '[[=' . c . '=]]'))
+ endif
+ endfor
+ endfor
+ endfor
+endfunc
+
+func Test_equivalence_re1()
+ set re=1
+ call s:equivalence_test()
+endfunc
+
+func Test_equivalence_re2()
+ set re=2
+ call s:equivalence_test()
+endfunc