@@ -56,27 +56,29 @@ func Test_swap_group()
5656 throw ' Skipped: need at least two groups, got ' . string (groups)
5757 endif
5858
59- call delete (' Xtest' )
60- split Xtest
61- call setline (1 , ' just some text' )
62- wq
63- if system (' ls -l Xtest' ) !~ ' ' . groups[0 ] . ' \d'
64- throw ' Skipped: test file does not have the first group'
65- else
66- silent ! chmod 640 Xtest
67- call system (' chgrp ' . groups[1 ] . ' Xtest' )
68- if system (' ls -l Xtest' ) !~ ' ' . groups[1 ] . ' \d'
69- throw ' Skipped: cannot set second group on test file'
59+ try
60+ call delete (' Xtest' )
61+ split Xtest
62+ call setline (1 , ' just some text' )
63+ wq
64+ if system (' ls -l Xtest' ) !~ ' ' . groups[0 ] . ' \d'
65+ throw ' Skipped: test file does not have the first group'
7066 else
71- split Xtest
72- let swapname = substitute (execute (' swapname' ), ' [[:space:]]' , ' ' , ' g' )
73- call assert_match (' Xtest' , swapname )
74- " Group of swapfile must now match original file.
75- call assert_match (' ' . groups[1 ] . ' \d' , system (' ls -l ' . swapname ))
67+ silent ! chmod 640 Xtest
68+ call system (' chgrp ' . groups[1 ] . ' Xtest' )
69+ if system (' ls -l Xtest' ) !~ ' ' . groups[1 ] . ' \d'
70+ throw ' Skipped: cannot set second group on test file'
71+ else
72+ split Xtest
73+ let swapname = substitute (execute (' swapname' ), ' [[:space:]]' , ' ' , ' g' )
74+ call assert_match (' Xtest' , swapname )
75+ " Group of swapfile must now match original file.
76+ call assert_match (' ' . groups[1 ] . ' \d' , system (' ls -l ' . swapname ))
7677
77- bwipe!
78+ bwipe!
79+ endif
7880 endif
79- endif
80-
81- call delete ( ' Xtest ' )
81+ finally
82+ call delete ( ' Xtest ' )
83+ endtry
8284endfunc
0 commit comments