bin/marutest in maruku-0.5.2 vs bin/marutest in maruku-0.5.3
- old
+ new
@@ -221,13 +221,11 @@
else
false
end
end
-def marutest
- args = ARGV.clone
-
+def marutest(args)
dont_worry = []
TOTEST.each do |x|
arg = "ok:#{x}"
# puts arg
if passed?(args, arg)
@@ -246,11 +244,12 @@
failed = {}
relaxed = {}
args.each do |f|
- $stdout.write "#{f}\n\t\t"
+ $stdout.write f + ' '*(50-f.size) + " "
+ $stdout.flush
tf, tr, tcrashed = run_test(f, dont_worry)
tf = tf + tcrashed
@@ -280,11 +279,11 @@
puts "\n\n\n**** FINAL REPORT ****\n\n"
if failed.size > 0
failed.each do |file, fl|
- num_failed += failed.size
+ num_failed += fl.size
if fl.size > 0
puts "\t#{file}\tfailed on #{fl.inspect}"
end
fl.each do |x|
failed_cat[x] = failed_cat[x] || 0
@@ -311,17 +310,18 @@
failed_cat.each do |x, num|
puts "\t#{x.inspect} \tfailed #{num}/#{args.size}"
end
end
- num_failed
+ return num_failed == 0
end
-
-if ARGV.empty?
- puts "marutest is a tool for running Maruku's unittest."
- exit
+if File.basename(__FILE__) == 'marutest'
+ if ARGV.empty?
+ puts "marutest is a tool for running Maruku's unittest."
+ exit 1
+ end
+ ok = marutest(ARGV.clone)
+
+ exit ok ? 0 : -1
end
-
-marutest
-