[vim] 12/139: patch 7.4.1700 Problem: Equivalence classes are not properly tested. Solution: Add tests for multi-byte and latin1. Fix an error. (Owen Leibman)

James McCoy jamessan at debian.org
Fri May 6 03:59:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch debian/sid
in repository vim.

commit 22e421549d54147d003f6444de007cb1d73f1d27
Author: Bram Moolenaar <Bram at 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)
---
 src/regexp.c                      |  4 ++--
 src/testdir/Make_all.mak          |  2 ++
 src/testdir/test_alot_latin.vim   |  7 +++++++
 src/testdir/test_alot_utf8.vim    |  7 +++++++
 src/testdir/test_regexp_latin.vim | 32 ++++++++++++++++++++++++++++++++
 src/testdir/test_regexp_utf8.vim  | 35 +++++++++++++++++++++++++++++++++++
 src/version.c                     |  2 ++
 7 files changed, 87 insertions(+), 2 deletions(-)

diff --git a/src/regexp.c b/src/regexp.c
index cd7dc3f..b20e9c5 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -791,7 +791,7 @@ char *EQUIVAL_CLASS_C[16] = {
     "E\x71\x72\x73\x74",
     "I\x75\x76\x77\x78",
     "N\x69",
-    "O\xEB\xEC\xED\xEE\xEF",
+    "O\xEB\xEC\xED\xEE\xEF\x80",
     "U\xFB\xFC\xFD\xFE",
     "Y\xBA",
     "a\x42\x43\x44\x45\x46\x47",
@@ -799,7 +799,7 @@ char *EQUIVAL_CLASS_C[16] = {
     "e\x51\x52\x53\x54",
     "i\x55\x56\x57\x58",
     "n\x49",
-    "o\xCB\xCC\xCD\xCE\xCF",
+    "o\xCB\xCC\xCD\xCE\xCF\x70",
     "u\xDB\xDC\xDD\xDE",
     "y\x8D\xDF",
 };
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 98cf985..2540abf 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -183,6 +183,8 @@ NEW_TESTS = test_arglist.res \
 	    test_viml.res \
 	    test_visual.res \
 	    test_window_id.res \
+	    test_alot_latin.res \
+	    test_alot_utf8.res \
 	    test_alot.res
 
 
diff --git a/src/testdir/test_alot_latin.vim b/src/testdir/test_alot_latin.vim
new file mode 100644
index 0000000..23a404c
--- /dev/null
+++ b/src/testdir/test_alot_latin.vim
@@ -0,0 +1,7 @@
+" A series of tests that can run in one Vim invocation.
+" This makes testing go faster, since Vim doesn't need to restart.
+
+" These tests use latin1 'encoding'.  Setting 'encoding' is in the individual
+" files, so that they can be run by themselves.
+
+source test_regexp_latin.vim
diff --git a/src/testdir/test_alot_utf8.vim b/src/testdir/test_alot_utf8.vim
new file mode 100644
index 0000000..20d919c
--- /dev/null
+++ b/src/testdir/test_alot_utf8.vim
@@ -0,0 +1,7 @@
+" A series of tests that can run in one Vim invocation.
+" This makes testing go faster, since Vim doesn't need to restart.
+
+" These tests use utf8 'encoding'.  Setting 'encoding' is in the individual
+" files, so that they can be run by themselves.
+
+source test_regexp_utf8.vim
diff --git a/src/testdir/test_regexp_latin.vim b/src/testdir/test_regexp_latin.vim
new file mode 100644
index 0000000..8528412
--- /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
diff --git a/src/testdir/test_regexp_utf8.vim b/src/testdir/test_regexp_utf8.vim
new file mode 100644
index 0000000..f5d7ec9
--- /dev/null
+++ b/src/testdir/test_regexp_utf8.vim
@@ -0,0 +1,35 @@
+" Tests for regexp in utf8 encoding
+if !has('multi_byte')
+  finish
+endif
+set encoding=utf-8
+scriptencoding utf-8
+
+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ñńņňʼ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
+	    " 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
diff --git a/src/version.c b/src/version.c
index 23d4acb..5ecf9e0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1700,
+/**/
     1699,
 /**/
     1698,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim.git



More information about the pkg-vim-maintainers mailing list