changeset 14487:336213a840d9 v8.1.0257

patch 8.1.0257: no test for pathshorten() commit https://github.com/vim/vim/commit/bfde0b482d25db43e9fc5a35c771b859b1eb8828 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 8 22:27:31 2018 +0200 patch 8.1.0257: no test for pathshorten() Problem: No test for pathshorten(). Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/3295)
author Christian Brabandt <cb@256bit.org>
date Wed, 08 Aug 2018 22:30:05 +0200
parents 4e34a56ce9ee
children dae46044a4d2
files src/testdir/test_functions.vim src/version.c
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -208,6 +208,21 @@ func Test_simplify()
   call assert_fails('call simplify(1.2)', 'E806:')
 endfunc
 
+func Test_pathshorten()
+  call assert_equal('', pathshorten(''))
+  call assert_equal('foo', pathshorten('foo'))
+  call assert_equal('/foo', pathshorten('/foo'))
+  call assert_equal('f/', pathshorten('foo/'))
+  call assert_equal('f/bar', pathshorten('foo/bar'))
+  call assert_equal('f/b/foobar', pathshorten('foo/bar/foobar'))
+  call assert_equal('/f/b/foobar', pathshorten('/foo/bar/foobar'))
+  call assert_equal('.f/bar', pathshorten('.foo/bar'))
+  call assert_equal('~f/bar', pathshorten('~foo/bar'))
+  call assert_equal('~.f/bar', pathshorten('~.foo/bar'))
+  call assert_equal('.~f/bar', pathshorten('.~foo/bar'))
+  call assert_equal('~/f/bar', pathshorten('~/foo/bar'))
+endfunc
+
 func Test_strpart()
   call assert_equal('de', strpart('abcdefg', 3, 2))
   call assert_equal('ab', strpart('abcdefg', -2, 4))
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    257,
+/**/
     256,
 /**/
     255,