summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-12-17 10:18:40 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2025-12-17 10:22:00 -0800
commitdc2a62e14c4691808f04ea0cb2de30c681e87923 (patch)
tree5424efc754bb723b983fcdde138e172aea4a047d /tool
parenta9526ab50ca693755cd841da1c73855448453dfb (diff)
test_commit_email.rb: Ensure #teardown doesn't fail
if test is omitted. Follow up c4e090def134f9b109991b74c027648564963763
Diffstat (limited to 'tool')
-rw-r--r--tool/test/test_commit_email.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/tool/test/test_commit_email.rb b/tool/test/test_commit_email.rb
index c7031f6c6e..db441584fd 100644
--- a/tool/test/test_commit_email.rb
+++ b/tool/test/test_commit_email.rb
@@ -36,9 +36,14 @@ class TestCommitEmail < Test::Unit::TestCase
end
def teardown
- File.unlink(@sendmail)
- Dir.rmdir(File.dirname(@sendmail))
- FileUtils.rm_rf(@ruby)
+ # Clean up temporary files if #setup was not omitted
+ if @sendmail
+ File.unlink(@sendmail)
+ Dir.rmdir(File.dirname(@sendmail))
+ end
+ if @ruby
+ FileUtils.rm_rf(@ruby)
+ end
end
def test_sendmail_encoding