aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/shared.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-04 21:52:44 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-02-04 21:52:44 +0800
commit041b2d6f1ea4b683b6ac258abb24ed6bbe72208d (patch)
treef5788bef0a2b65ba925f4a0f6ba41a07e61eb705 /src/nvim/testdir/shared.vim
parentcb863d4e1f2c14eca46dda053a0d3062a0802196 (diff)
downloadrneovim-041b2d6f1ea4b683b6ac258abb24ed6bbe72208d.tar.gz
rneovim-041b2d6f1ea4b683b6ac258abb24ed6bbe72208d.tar.bz2
rneovim-041b2d6f1ea4b683b6ac258abb24ed6bbe72208d.zip
vim-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 vim/vim#5020) https://github.com/vim/vim/commit/07282f01da06c158bab4787adc89ec15d7eeb202 Skip test_terminal.vim and test_viminfo.vim: N/A
Diffstat (limited to 'src/nvim/testdir/shared.vim')
-rw-r--r--src/nvim/testdir/shared.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim
index f456ff4250..c2809844ac 100644
--- a/src/nvim/testdir/shared.vim
+++ b/src/nvim/testdir/shared.vim
@@ -343,6 +343,15 @@ func RunVimPiped(before, after, arguments, pipecmd)
return 1
endfunc
+func IsRoot()
+ if !has('unix')
+ return v:false
+ elseif $USER == 'root' || system('id -un') =~ '\<root\>'
+ return v:true
+ endif
+ return v:false
+endfunc
+
" Get all messages but drop the maintainer entry.
func GetMessages()
redir => result