]> granicus.if.org Git - vim/commitdiff
patch 7.4.1734 v7.4.1734
authorBram Moolenaar <Bram@vim.org>
Thu, 14 Apr 2016 14:57:10 +0000 (16:57 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 14 Apr 2016 14:57:10 +0000 (16:57 +0200)
Problem:    Test fails when not using utf-8.
Solution:   Split test in regularand utf-8 part.

src/testdir/test_alot_utf8.vim
src/testdir/test_expr.vim
src/testdir/test_expr_utf8.vim [new file with mode: 0644]
src/version.c

index 20d919c323da1c743aaaa6e2c2d5fac0ba7a5d37..e55555e6e4c99c9e570dd2aeb102356f0cb98e5d 100644 (file)
@@ -4,4 +4,5 @@
 " These tests use utf8 'encoding'.  Setting 'encoding' is in the individual
 " files, so that they can be run by themselves.
 
+source test_expr_utf8.vim
 source test_regexp_utf8.vim
index cdaf45ee734422122421661acde7dcda88007a5f..c8c8e2c2a4c8b7f6a5ea30d87c020cf1e70cd9f5 100644 (file)
@@ -59,17 +59,6 @@ func Test_strgetchar()
   call assert_equal(-1, strgetchar('axb', -1))
   call assert_equal(-1, strgetchar('axb', 3))
   call assert_equal(-1, strgetchar('', 0))
-
-  if !has('multi_byte')
-    return
-  endif
-
-  call assert_equal(char2nr('á'), strgetchar('áxb', 0))
-  call assert_equal(char2nr('x'), strgetchar('áxb', 1))
-
-  call assert_equal(char2nr('a'), strgetchar('àxb', 0))
-  call assert_equal(char2nr('̀'), strgetchar('àxb', 1))
-  call assert_equal(char2nr('x'), strgetchar('àxb', 2))
 endfunc
 
 func Test_strcharpart()
@@ -84,16 +73,4 @@ func Test_strcharpart()
   call assert_equal('', strcharpart('axb', -2, 2))
 
   call assert_equal('a', strcharpart('axb', -1, 2))
-
-  if !has('multi_byte')
-    return
-  endif
-
-  call assert_equal('áxb', strcharpart('áxb', 0))
-  call assert_equal('á', strcharpart('áxb', 0, 1))
-  call assert_equal('x', strcharpart('áxb', 1, 1))
-
-  call assert_equal('a', strcharpart('àxb', 0, 1))
-  call assert_equal('̀', strcharpart('àxb', 1, 1))
-  call assert_equal('x', strcharpart('àxb', 2, 1))
 endfunc
diff --git a/src/testdir/test_expr_utf8.vim b/src/testdir/test_expr_utf8.vim
new file mode 100644 (file)
index 0000000..8b10e63
--- /dev/null
@@ -0,0 +1,26 @@
+" Tests for expressions using utf-8.
+if !has('multi_byte')
+  finish
+endif
+set encoding=utf-8
+scriptencoding utf-8
+
+func Test_strgetchar()
+  call assert_equal(char2nr('a'), strgetchar('axb', 0))
+  call assert_equal(char2nr('x'), strgetchar('axb', 1))
+  call assert_equal(char2nr('b'), strgetchar('axb', 2))
+
+  call assert_equal(-1, strgetchar('axb', -1))
+  call assert_equal(-1, strgetchar('axb', 3))
+  call assert_equal(-1, strgetchar('', 0))
+endfunc
+
+func Test_strcharpart()
+  call assert_equal('áxb', strcharpart('áxb', 0))
+  call assert_equal('á', strcharpart('áxb', 0, 1))
+  call assert_equal('x', strcharpart('áxb', 1, 1))
+
+  call assert_equal('a', strcharpart('àxb', 0, 1))
+  call assert_equal('̀', strcharpart('àxb', 1, 1))
+  call assert_equal('x', strcharpart('àxb', 2, 1))
+endfunc
index 873f21c2bcbc1168cb38947f281498a153ff8926..a013661c5ad4dd75b6869437fbe5139920b243c3 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1734,
 /**/
     1733,
 /**/