Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CHANGE: Default output is less verbose (eg. PASS/FAIL/SKIP)

  • Loading branch information...
commit ef1c0017a1f940e02e0d523c90d59dc74eaa2509 1 parent 40fa2d5
@delano authored
Showing with 25 additions and 9 deletions.
  1. +3 −0  CHANGES.txt
  2. +22 −9 lib/tryouts.rb
View
3  CHANGES.txt
@@ -2,6 +2,9 @@ TRYOUTS, CHANGES
#### 2.1.0 (2011-02-12) ###############################
+* CHANGE: Default output is less verbose (eg. PASS/FAIL/SKIP)
+* CHANGE: -q now prints nothing to STDOUT. Check $?. If 0, all tests pass
+ otherwise it contains the number of tests that failed.
* ADDED: -v option for increased output.
View
31 lib/tryouts.rb
@@ -57,27 +57,39 @@ def run_all *paths
vmsg '%-60s %s' % [path, '']
before_handler = Proc.new do |t|
- vmsg Console.reverse(' %-58s ' % [t.desc.to_s])
- vmsg t.test.inspect, t.exps.inspect
+ if Tryouts.noisy
+ vmsg Console.reverse(' %-58s ' % [t.desc.to_s])
+ vmsg t.test.inspect, t.exps.inspect
+ end
end
batch.run(before_handler) do |t|
if t.failed?
failed_tests += 1
- vmsg Console.color(:red, t.failed.join($/)), $/
+ if Tryouts.noisy
+ vmsg Console.color(:red, t.failed.join($/)), $/
+ else
+ msg ' %s (%s:%s)' % [Console.color(:red, "FAIL"), path, t.exps.first]
+ end
elsif t.skipped? || !t.run?
skipped_tests += 1
- vmsg Console.bright(t.skipped.join($/)), $/
+ if Tryouts.noisy
+ vmsg Console.bright(t.skipped.join($/)), $/
+ else
+ msg ' SKIP (%s:%s)' % [path, t.exps.first]
+ end
else
- vmsg Console.color(:green, t.passed.join($/)), $/
+ if Tryouts.noisy
+ vmsg Console.color(:green, t.passed.join($/)), $/
+ else
+ msg ' %s' % [Console.color(:green, 'PASS')]
+ end
end
-
all += 1
-
end
end
- vmsg
+ msg
if all > 0
suffix = 'tests passed'
suffix << " (and #{skipped_tests} skipped)" if skipped_tests > 0
@@ -95,7 +107,7 @@ def run_all *paths
end
def cformat(*args)
- Console.bright '%3d of %d %s' % args
+ Console.bright '%d of %d %s' % args
end
def run path
@@ -173,6 +185,7 @@ def parse path
end
def print str
+ return if Tryouts.quiet
STDOUT.print str
STDOUT.flush
end
Please sign in to comment.
Something went wrong with that request. Please try again.