Mercurial > vim
comparison src/testdir/test_rename.vim @ 18277:f6dcf7eabd26 v8.1.2133
patch 8.1.2133: some tests fail when run as root
Commit: https://github.com/vim/vim/commit/07282f01da06c158bab4787adc89ec15d7eeb202
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 10 16:46:17 2019 +0200
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 https://github.com/vim/vim/issues/5020)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 10 Oct 2019 17:00:03 +0200 |
parents | 2029737e6a22 |
children | 08940efa6b4e |
comparison
equal
deleted
inserted
replaced
18276:79b045ead26e | 18277:f6dcf7eabd26 |
---|---|
1 " Test rename() | 1 " Test rename() |
2 | |
3 source shared.vim | |
2 | 4 |
3 func Test_rename_file_to_file() | 5 func Test_rename_file_to_file() |
4 call writefile(['foo'], 'Xrename1') | 6 call writefile(['foo'], 'Xrename1') |
5 | 7 |
6 call assert_equal(0, rename('Xrename1', 'Xrename2')) | 8 call assert_equal(0, rename('Xrename1', 'Xrename2')) |
79 call writefile(['foo'], 'Xrenamedir/Xrenamefile') | 81 call writefile(['foo'], 'Xrenamedir/Xrenamefile') |
80 call setfperm('Xrenamedir', 'r-xr-xr-x') | 82 call setfperm('Xrenamedir', 'r-xr-xr-x') |
81 | 83 |
82 call assert_equal(0, rename('Xrenamedir/Xrenamefile', 'Xrenamefile')) | 84 call assert_equal(0, rename('Xrenamedir/Xrenamefile', 'Xrenamefile')) |
83 | 85 |
84 if !has('win32') | 86 if !has('win32') && !IsRoot() |
85 " On Windows, the source file is removed despite | 87 " On Windows, the source file is removed despite |
86 " its directory being made not writable. | 88 " its directory being made not writable. |
87 call assert_equal(['foo'], readfile('Xrenamedir/Xrenamefile')) | 89 call assert_equal(['foo'], readfile('Xrenamedir/Xrenamefile')) |
88 endif | 90 endif |
89 call assert_equal(['foo'], readfile('Xrenamefile')) | 91 call assert_equal(['foo'], readfile('Xrenamefile')) |