patch 8.0.1734: package directory not added to 'rtp' if prefix matches
Problem: Package directory not added to 'rtp' if prefix matches.
Solution: Check the match is a full match. (Ozaki Kiichi, closes #2817)
Also handle different ways of spelling a path.
diff --git a/src/testdir/test_packadd.vim b/src/testdir/test_packadd.vim
index 889d77f..64bd8d2 100644
--- a/src/testdir/test_packadd.vim
+++ b/src/testdir/test_packadd.vim
@@ -40,6 +40,15 @@
call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp)
call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp)
+ " NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest'
+ call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p')
+ let rtp = &rtp
+ packadd myte
+
+ " Check the path of 'myte' is added
+ call assert_true(len(&rtp) > len(rtp))
+ call assert_match('/testdir/Xdir/pack/mine/opt/myte\($\|,\)', &rtp)
+
" Check exception
call assert_fails("packadd directorynotfound", 'E919:')
call assert_fails("packadd", 'E471:')