aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-09 09:48:59 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-09 09:49:07 -0400
commit6ad8294d5cb3aa934c524141a5f3b86c769becfc (patch)
tree90522d6f7da5e0976c5452cb5a553b667d778072 /src
parent218fccaba4c897f294cb2f21a63fb1c76f387970 (diff)
downloadrneovim-6ad8294d5cb3aa934c524141a5f3b86c769becfc.tar.gz
rneovim-6ad8294d5cb3aa934c524141a5f3b86c769becfc.tar.bz2
rneovim-6ad8294d5cb3aa934c524141a5f3b86c769becfc.zip
vim-patch:8.1.0257: no test for pathshorten()
Problem: No test for pathshorten(). Solution: Add a test. (Dominique Pelle, closes vim/vim#3295) https://github.com/vim/vim/commit/bfde0b482d25db43e9fc5a35c771b859b1eb8828
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_functions.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 754a7ca18a..6d0a6b9d5e 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -239,6 +239,21 @@ func Test_setbufvar_options()
bwipe!
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))