From 50427a230f7cc021618a35409dbaea688ee206eb Mon Sep 17 00:00:00 2001 From: "MATSUMOTO, Katsuyoshi" Date: Sat, 31 Aug 2024 13:34:54 +0900 Subject: [PATCH] wrong setup and teadown --- test/vaporware/test_compiler.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/vaporware/test_compiler.rb b/test/vaporware/test_compiler.rb index 7e6e278..0a936dc 100644 --- a/test/vaporware/test_compiler.rb +++ b/test/vaporware/test_compiler.rb @@ -2,10 +2,14 @@ require "test/unit" class Vaporware::CompilerTest < Test::Unit::TestCase - def tear_down = File.delete("tmp") rescue File.delete(@generated) + def setup = @generated = ["tmp.s", "tmp.o"] + def teardown + File.delete("tmp") if File.exist?("tmp") + @generated.map { File.delete(_1) } + end def test_sample_plus @file = "sample/plus.rb" - @vaporware = Vaporware::Compiler.compile(@file, debug: true) + @vaporware = Vaporware::Compiler.compile(@file) IO.popen("./tmp").close exit_code, handle_code = check_process($?.to_i) assert_equal(9, exit_code) @@ -49,7 +53,7 @@ def test_sample_while end def test_sample_call_method - @generated = "libtmp.so" + @generated = ["libtmp.so", "libtmp.so.o", "libtmp.so.s"] @file = "sample/method.rb" @vaporware = Vaporware::Compiler.compile(@file, dest: "./libtmp.so", shared: true) require './sample/fiddle.rb'