tryouts 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/CHANGES.txt +4 -0
  2. data/VERSION.yml +1 -1
  3. data/bin/try +14 -0
  4. data/lib/tryouts.rb +9 -8
  5. metadata +4 -4
data/CHANGES.txt CHANGED
@@ -1,5 +1,9 @@
1
1
  TRYOUTS, CHANGES
2
2
 
3
+ #### 2.0.4 (2011-01-06) ###############################
4
+
5
+ * ADDED: -q option for reduced output.
6
+
3
7
  #### 2.0.3 (2010-11-03) ###############################
4
8
 
5
9
  * FIXED: Print test value not expected value twice!
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :MAJOR: 2
3
3
  :MINOR: 0
4
- :PATCH: 3
4
+ :PATCH: 4
5
5
  :BUILD: '001'
data/bin/try CHANGED
@@ -1,5 +1,16 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
+ #
4
+ # Tryouts - Don't waste your time writing tests
5
+ #
6
+ # Usage:
7
+ #
8
+ # $ try
9
+ # $ try -q
10
+ # $ try path/2/file.rb
11
+ # $ try -q path/2/file.rb path/2/another.rb
12
+ #
13
+
3
14
  # Put our local lib in first place
4
15
  BASE_PATH = File.expand_path File.join(File.dirname(__FILE__), '..')
5
16
  lib_dir = File.join(BASE_PATH, 'lib')
@@ -12,6 +23,8 @@ require 'tryouts'
12
23
  $:.unshift dir
13
24
  end
14
25
 
26
+ Tryouts.quiet = !ARGV.delete('-q').nil? # eg try -q [PATH]
27
+
15
28
  if ARGV.empty?
16
29
  paths = Dir.glob(File.join(Dir.pwd, '{try,tryouts}', '*_{try,tryouts}.rb'))
17
30
  paths += Dir.glob(File.join(Dir.pwd, '*_{try,tryouts}.rb'))
@@ -19,6 +32,7 @@ else
19
32
  paths = ARGV
20
33
  end
21
34
 
35
+ #Tryouts.quiet
22
36
  #Tryouts.debug = true
23
37
  #Tryouts.container = self
24
38
 
data/lib/tryouts.rb CHANGED
@@ -26,11 +26,12 @@ end
26
26
 
27
27
  class Tryouts
28
28
  @debug = false
29
+ @quiet = false
29
30
  @container = Class.new
30
31
  @cases = []
31
32
  @sysinfo = nil
32
33
  class << self
33
- attr_accessor :debug, :container
34
+ attr_accessor :debug, :container, :quiet
34
35
  attr_reader :cases
35
36
 
36
37
  def sysinfo
@@ -55,22 +56,22 @@ class Tryouts
55
56
 
56
57
  path = batch.path.gsub(/#{Dir.pwd}\/?/, '')
57
58
 
58
- msg '%-60s %s' % [path, ''] # status
59
+ msg '%-60s %s' % [path, ''] unless Tryouts.quiet # status
59
60
 
60
61
  before_handler = Proc.new do |t|
61
- msg Console.reverse(' %-58s ' % [t.desc.to_s])
62
- msg t.test.inspect, t.exps.inspect
62
+ msg Console.reverse(' %-58s ' % [t.desc.to_s]) unless Tryouts.quiet
63
+ msg t.test.inspect, t.exps.inspect unless Tryouts.quiet
63
64
  end
64
65
 
65
66
  batch.run(before_handler) do |t|
66
67
  if t.failed?
67
68
  failed_tests += 1
68
- msg Console.color(:red, t.failed.join($/)), $/
69
+ msg Console.color(:red, t.failed.join($/)), $/ unless Tryouts.quiet
69
70
  elsif t.skipped? || !t.run?
70
71
  skipped_tests += 1
71
- msg Console.bright(t.skipped.join($/)), $/
72
+ msg Console.bright(t.skipped.join($/)), $/ unless Tryouts.quiet
72
73
  else
73
- msg Console.color(:green, t.passed.join($/)), $/
74
+ msg Console.color(:green, t.passed.join($/)), $/ unless Tryouts.quiet
74
75
  end
75
76
 
76
77
  all += 1
@@ -78,7 +79,7 @@ class Tryouts
78
79
  end
79
80
  end
80
81
 
81
- msg
82
+ msg unless Tryouts.quiet
82
83
  if all > 0
83
84
  suffix = 'tests passed'
84
85
  suffix << " (and #{skipped_tests} skipped)" if skipped_tests > 0
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tryouts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 3
10
- version: 2.0.3
9
+ - 4
10
+ version: 2.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Delano Mandelbaum
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-03 00:00:00 -04:00
18
+ date: 2011-01-06 00:00:00 -05:00
19
19
  default_executable: try
20
20
  dependencies: []
21
21