bin/rgot in rgot-0.1.4 vs bin/rgot in rgot-0.1.5
- old
+ new
@@ -7,11 +7,11 @@
parser = OptionParser.new do |o|
o.on '-v', '--verbose', "log all tests" do |arg|
Rgot.class_eval{ @chatty = arg }
end
o.on '--version', "show Rgot version" do |arg|
- puts "Rgot v#{Rgot::VERSION}"
+ puts "rgot #{Rgot::VERSION} (ruby #{RUBY_VERSION})"
exit 0
end
o.on '--bench [regexp]', "benchmark" do |arg|
unless arg
raise Rgot::OptionError, "missing argument for flag --bench"
@@ -40,25 +40,25 @@
parser.parse!(ARGV)
require_paths.each do |path|
require path
end
-ARGV.each do |target|
- if target
+if ARGV.empty?
+ Dir.glob("./**/*_test.rb") do |i|
+ require i
+ end
+else
+ ARGV.each do |target|
if File.file?(target)
require File.expand_path(target)
elsif File.directory?(target)
Dir.glob("./#{target}/**/*_test.rb") do |i|
require i
end
else
puts target
end
- else
- Dir.glob("./**/*_test.rb") do |i|
- require i
- end
end
end
modules = Object.constants.select { |c|
next if c == :FileTest
@@ -78,11 +78,11 @@
pid = fork {
tests = []
benchmarks = []
examples = []
main = nil
- methods = test_module.instance_methods.sort
+ methods = test_module.instance_methods
methods.grep(/\Atest_/).each do |m|
if m == :test_main && main.nil?
main = Rgot::InternalTest.new(test_module, m)
else
tests << Rgot::InternalTest.new(test_module, m)
@@ -103,12 +103,13 @@
case $!
when SystemExit
if $!.success?
# exit 0
- puts sprintf(template, "ok", test_module, Rgot.now - duration)
+ puts sprintf(template, "ok ", test_module, Rgot.now - duration)
else
# exit 1
+ puts "exit status #{$!.status}"
puts sprintf(template, "FAIL", test_module, Rgot.now - duration)
end
when NilClass
# not raise, not exit
else