patch 8.2.0203: :helptags and some other functionality not tested
Problem: :helptags and some other functionality not tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes #5567)
diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim
index ee5ace8..3b6ad39 100644
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -72,3 +72,41 @@
call feedkeys(":help :undo\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"help :undo :undoj :undol :undojoin :undolist', @:)
endfunc
+
+" Test for the :helptags command
+func Test_helptag_cmd()
+ call mkdir('Xdir/a/doc', 'p')
+
+ " No help file to process in the directory
+ call assert_fails('helptags Xdir', 'E151:')
+
+ call writefile([], 'Xdir/a/doc/sample.txt')
+
+ " Test for ++t argument
+ helptags ++t Xdir
+ call assert_equal(["help-tags\ttags\t1"], readfile('Xdir/tags'))
+ call delete('Xdir/tags')
+
+ " The following tests fail on FreeBSD for some reason
+ if has('unix') && !has('bsd')
+ " Read-only tags file
+ call writefile([''], 'Xdir/tags')
+ call setfperm('Xdir/tags', 'r-xr--r--')
+ call assert_fails('helptags Xdir', 'E152:', getfperm('Xdir/tags'))
+ call delete('Xdir/tags')
+
+ " No permission to read the help file
+ call setfperm('Xdir/a/doc/sample.txt', '-w-------')
+ call assert_fails('helptags Xdir', 'E153:', getfperm('Xdir/a/doc/sample.txt'))
+ call delete('Xdir/a/doc/sample.txt')
+ call delete('Xdir/tags')
+ endif
+
+ " Duplicate tags in the help file
+ call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xdir/a/doc/sample.txt')
+ call assert_fails('helptags Xdir', 'E154:')
+
+ call delete('Xdir', 'rf')
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab