patch 8.1.2133: some tests fail when run as root
Problem: Some tests fail when run as root.
Solution: Add CheckNotRoot and use it. (James McCoy, closes #5020)
diff --git a/src/testdir/check.vim b/src/testdir/check.vim
index f176f83..6c3b1be 100644
--- a/src/testdir/check.vim
+++ b/src/testdir/check.vim
@@ -1,3 +1,5 @@
+source shared.vim
+
" Command to check for the presence of a feature.
command -nargs=1 CheckFeature call CheckFeature(<f-args>)
func CheckFeature(name)
@@ -102,3 +104,11 @@
throw 'Skipped: only works in the terminal'
endif
endfunc
+
+" Command to check that test is not running as root
+command CheckNotRoot call CheckNotRoot()
+func CheckNotRoot()
+ if IsRoot()
+ throw 'Skipped: cannot run test as root'
+ endif
+endfunc