Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit ef1c0017a1f940e02e0d523c90d59dc74eaa2509 1 parent 40fa2d5
Delano Mandelbaum authored
3  CHANGES.txt
@@ -2,6 +2,9 @@ TRYOUTS, CHANGES
2 2
 
3 3
 #### 2.1.0 (2011-02-12) ###############################
4 4
 
  5
+* CHANGE: Default output is less verbose (eg. PASS/FAIL/SKIP)
  6
+* CHANGE: -q now prints nothing to STDOUT. Check $?. If 0, all tests pass
  7
+          otherwise it contains the number of tests that failed. 
5 8
 * ADDED: -v option for increased output.
6 9
 
7 10
 
31  lib/tryouts.rb
@@ -57,27 +57,39 @@ def run_all *paths
57 57
         vmsg '%-60s %s' % [path, '']
58 58
         
59 59
         before_handler = Proc.new do |t|
60  
-          vmsg Console.reverse(' %-58s ' % [t.desc.to_s]) 
61  
-          vmsg t.test.inspect, t.exps.inspect
  60
+          if Tryouts.noisy
  61
+            vmsg Console.reverse(' %-58s ' % [t.desc.to_s]) 
  62
+            vmsg t.test.inspect, t.exps.inspect
  63
+          end
62 64
         end
63 65
         
64 66
         batch.run(before_handler) do |t|
65 67
           if t.failed? 
66 68
             failed_tests += 1
67  
-            vmsg Console.color(:red, t.failed.join($/)), $/
  69
+            if Tryouts.noisy 
  70
+              vmsg Console.color(:red, t.failed.join($/)), $/
  71
+            else
  72
+              msg ' %s (%s:%s)' % [Console.color(:red, "FAIL"), path, t.exps.first]
  73
+            end
68 74
           elsif t.skipped? || !t.run?
69 75
             skipped_tests += 1
70  
-            vmsg Console.bright(t.skipped.join($/)), $/
  76
+            if Tryouts.noisy
  77
+              vmsg Console.bright(t.skipped.join($/)), $/
  78
+            else
  79
+              msg ' SKIP (%s:%s)' % [path, t.exps.first]
  80
+            end
71 81
           else
72  
-            vmsg Console.color(:green, t.passed.join($/)), $/
  82
+            if Tryouts.noisy
  83
+              vmsg Console.color(:green, t.passed.join($/)), $/
  84
+            else
  85
+              msg ' %s' % [Console.color(:green, 'PASS')]
  86
+            end
73 87
           end
74  
-          
75 88
           all += 1
76  
-          
77 89
         end
78 90
       end
79 91
       
80  
-      vmsg
  92
+      msg
81 93
       if all > 0
82 94
         suffix = 'tests passed'
83 95
         suffix << " (and #{skipped_tests} skipped)" if skipped_tests > 0
@@ -95,7 +107,7 @@ def run_all *paths
95 107
     end
96 108
     
97 109
     def cformat(*args)
98  
-      Console.bright '%3d of %d %s' % args
  110
+      Console.bright '%d of %d %s' % args
99 111
     end
100 112
     
101 113
     def run path
@@ -173,6 +185,7 @@ def parse path
173 185
     end
174 186
     
175 187
     def print str
  188
+      return if Tryouts.quiet
176 189
       STDOUT.print str
177 190
       STDOUT.flush
178 191
     end

0 notes on commit ef1c001

Please sign in to comment.
Something went wrong with that request. Please try again.