summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-11-18 20:32:03 +0100
committerBram Moolenaar <Bram@vim.org>2017-11-18 20:32:03 +0100
commitc7d16dce2f180c8ebfc8105ad090b0ea2deedcdc (patch)
tree99989cb7f69108b4f714b12ef5c48ec2ab102d9a
parent0f1e643138d47bfc94a7050c5bd25493c2153960 (diff)
patch 8.0.1311: no test for strpart()v8.0.1311
Problem: No test for strpart(). Solution: Add a test. (Dominique Pelle, closes #2347)
-rw-r--r--src/testdir/test_functions.vim44
-rw-r--r--src/version.c2
2 files changed, 31 insertions, 15 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index bdc7388267..d9040137c6 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1,5 +1,21 @@
" Tests for various functions.
+" Must be done first, since the alternate buffer must be unset.
+func Test_00_bufexists()
+ call assert_equal(0, bufexists('does_not_exist'))
+ call assert_equal(1, bufexists(bufnr('%')))
+ call assert_equal(0, bufexists(0))
+ new Xfoo
+ let bn = bufnr('%')
+ call assert_equal(1, bufexists(bn))
+ call assert_equal(1, bufexists('Xfoo'))
+ call assert_equal(1, bufexists(getcwd() . '/Xfoo'))
+ call assert_equal(1, bufexists(0))
+ bw
+ call assert_equal(0, bufexists(bn))
+ call assert_equal(0, bufexists('Xfoo'))
+endfunc
+
func Test_empty()
call assert_equal(1, empty(''))
call assert_equal(0, empty('a'))
@@ -168,6 +184,19 @@ func Test_simplify()
call assert_fails('call simplify(1.2)', 'E806:')
endfunc
+func Test_strpart()
+ call assert_equal('de', strpart('abcdefg', 3, 2))
+ call assert_equal('ab', strpart('abcdefg', -2, 4))
+ call assert_equal('abcdefg', strpart('abcdefg', -2))
+ call assert_equal('fg', strpart('abcdefg', 5, 4))
+ call assert_equal('defg', strpart('abcdefg', 3))
+
+ if has('multi_byte')
+ call assert_equal('lép', strpart('éléphant', 2, 4))
+ call assert_equal('léphant', strpart('éléphant', 2))
+ endif
+endfunc
+
func Test_tolower()
call assert_equal("", tolower(""))
@@ -478,21 +507,6 @@ func Test_getbufvar()
set fileformats&
endfunc
-func Test_bufexists()
- call assert_equal(0, bufexists('does_not_exist'))
- call assert_equal(1, bufexists(bufnr('%')))
- call assert_equal(0, bufexists(0))
- new Xfoo
- let bn = bufnr('%')
- call assert_equal(1, bufexists(bn))
- call assert_equal(1, bufexists('Xfoo'))
- call assert_equal(1, bufexists(getcwd() . '/Xfoo'))
- call assert_equal(1, bufexists(0))
- bw
- call assert_equal(0, bufexists(bn))
- call assert_equal(0, bufexists('Xfoo'))
-endfunc
-
func Test_last_buffer_nr()
call assert_equal(bufnr('$'), last_buffer_nr())
endfunc
diff --git a/src/version.c b/src/version.c
index 331edb5c3e..87f922f94b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1311,
+/**/
1310,
/**/
1309,