From: nobu.nokada@... Date: 2004-05-26T04:52:57+09:00 Subject: Re: Autogenerating test targets with mkmf Hi, At Tue, 25 May 2004 22:17:00 +0900, Berger, Daniel wrote in [ruby-core:02948]: > Looks good, though I think it should be limited to tc_*.rb files under > 'test'. Test::Unit uses test_*.rb by default, which can be changed by -p option. And some libraries already use test: target. Index: lib/mkmf.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/mkmf.rb,v retrieving revision 1.190 diff -U2 -p -d -r1.190 mkmf.rb --- lib/mkmf.rb 20 May 2004 08:02:10 -0000 1.190 +++ lib/mkmf.rb 25 May 2004 19:47:49 -0000 @@ -886,4 +886,6 @@ target_prefix = #{target_prefix} DLLIB = #{dllib} STATIC_LIB = #{staticlib unless $static.nil?} +TESTOPTS = #{$testopts} +TESTDIR = #{$testdir || "$(srcdir)/test"} } if $extout @@ -914,4 +916,10 @@ all: #{target ? $extout ? "install" : " static: $(STATIC_LIB) +.PHONY: unittest + +PHONY: + +unittest: $(DLLIB) PHONY + $(RUBY) -rtest/unit -I. -ep -- $(TESTOPTS) $(TESTDIR) } mfile.print CLEANINGS Index: lib/test/unit.rb =================================================================== RCS file: /cvs/ruby/src/ruby/lib/test/unit.rb,v retrieving revision 1.10 diff -U2 -p -d -r1.10 unit.rb --- lib/test/unit.rb 4 Mar 2004 15:53:39 -0000 1.10 +++ lib/test/unit.rb 25 May 2004 19:38:47 -0000 @@ -272,3 +272,7 @@ module Test # :nodoc: end -at_exit{exit(Test::Unit::AutoRunner.run($0)) unless($! || Test::Unit.run?)} +at_exit do + unless $! || Test::Unit.run? + exit Test::Unit::AutoRunner.run($0 != "-e" && $0) + end +end -- Nobu Nakada