Skip to content

Commit dc2a62e

Browse files
committed
test_commit_email.rb: Ensure #teardown doesn't fail
if test is omitted. Follow up c4e090d
1 parent a9526ab commit dc2a62e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tool/test/test_commit_email.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ def setup
3636
end
3737

3838
def teardown
39-
File.unlink(@sendmail)
40-
Dir.rmdir(File.dirname(@sendmail))
41-
FileUtils.rm_rf(@ruby)
39+
# Clean up temporary files if #setup was not omitted
40+
if @sendmail
41+
File.unlink(@sendmail)
42+
Dir.rmdir(File.dirname(@sendmail))
43+
end
44+
if @ruby
45+
FileUtils.rm_rf(@ruby)
46+
end
4247
end
4348

4449
def test_sendmail_encoding

0 commit comments

Comments
 (0)