delano-tryouts 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,6 +1,15 @@
1
1
  TRYOUTS, CHANGES
2
2
 
3
3
 
4
+ #### 0.7.4 (2009-06-29) ###############################
5
+
6
+ * FIXED: The stash method is now available to :benchmark drills
7
+ * FIXED: Specifying a single argument to drill with a block now
8
+ correctly parses the arg as the expected dream output.
9
+ * CHANGE: Differentiated non-fatal error messages for successful drills
10
+ * CHANGE: Context sensitive message for LoadErrors in Tryouts#library
11
+
12
+
4
13
  #### 0.7.3 (2009-06-27) ###############################
5
14
 
6
15
  * ADDED: Display Tryouts group name for runtime errors.
@@ -39,7 +39,7 @@ class Run < Drydock::Command
39
39
 
40
40
  if Tryouts.verbose > 0
41
41
  print "Tryouts #{Tryouts::VERSION} -- "
42
- print "#{Tryouts.sysinfo.to_s} (#{RUBY_VERSION}) -- "
42
+ print "#{Tryouts.sysinfo.to_s}@#{RUBY_VERSION} -- "
43
43
  puts "#{start.strftime("%Y-%m-%d %H:%M:%S")}"
44
44
  puts
45
45
  end
@@ -48,6 +48,7 @@ class Run < Drydock::Command
48
48
 
49
49
  passed, failed = 0, 0
50
50
  Tryouts.instances.each_pair do |group,tryouts_inst|
51
+ puts unless group == Tryouts.instances.keys.first
51
52
  puts ' %-79s'.att(:reverse) % group unless Tryouts.verbose < 0
52
53
  puts " #{tryouts_inst.paths.join("\n ")}" if Tryouts.verbose > 0
53
54
  tryouts_inst.tryouts.each_pair do |name,to|
@@ -70,7 +71,7 @@ class Run < Drydock::Command
70
71
 
71
72
  puts '%4s%s: %s' % ['', ex.class, ex.message.to_s.split($/).join($/ + ' '*16)]
72
73
  puts
73
-
74
+
74
75
  if [SyntaxError].member? ex.class
75
76
  # don't print anymore.
76
77
  else
@@ -2,7 +2,7 @@
2
2
  class Tryouts
3
3
  class Tryout
4
4
 
5
- # All :api Drills are run within this context (not used for :cli).
5
+ # All :api and :benchmark drills are run within this context.
6
6
  # Each Drill is executed in a new instance of this class. That means
7
7
  # instance variables are not carried through, but class variables are.
8
8
  # The before and after blocks are also run in this context.
@@ -193,9 +193,11 @@ class Tryouts::Drill
193
193
  when nil
194
194
  @output
195
195
  else
196
- if @output.nil?
197
- @output
198
- elsif @output.respond_to?(dream.format.to_sym)
196
+ return nil if @output.nil?
197
+
198
+ if !dream.format.is_a?(Symbol)
199
+ "This dream format is not a Symbol: #{dream.format}"
200
+ elsif @output.respond_to?(dream.format)
199
201
  @output.send(dream.format)
200
202
  else
201
203
  @output
@@ -31,7 +31,9 @@ class Tryouts; class Drill; module Sergeant
31
31
  begin
32
32
 
33
33
  @reps.times do
34
- run = ::Benchmark.realtime &runtime
34
+ run = ::Benchmark.realtime {
35
+ context.instance_eval &runtime
36
+ }
35
37
  @stats.sample run
36
38
  end
37
39
 
data/lib/tryouts/drill.rb CHANGED
@@ -53,9 +53,13 @@ class Tryouts
53
53
  @sergeant = Tryouts::Drill::Sergeant::CLI.new *args
54
54
  when :api
55
55
  default_output = drill.nil? ? args.shift : nil
56
- dream_output, format = *(args.size == 1 ? args.first : args.reverse)
57
56
  @sergeant = Tryouts::Drill::Sergeant::API.new default_output
58
57
  unless args.empty?
58
+ if args.size == 1
59
+ dream_output, format = args.first, nil
60
+ else
61
+ dream_output, format = args[1], args[0]
62
+ end
59
63
  @dreams << Tryouts::Drill::Dream.new(dream_output, format)
60
64
  end
61
65
  when :benchmark
@@ -85,8 +85,8 @@ class Tryouts
85
85
  success = @drills.select { |d| !d.skip? && d.success? }
86
86
  success.each do |drill,index|
87
87
  next unless drill.has_error?
88
- title = ' %-69s ' % ["\"#{drill.name}\""]
89
- puts $/, ' ' << title.color(:red).att(:reverse)
88
+ title = ' Non-fatal error in: %-69s ' % ["\"#{drill.name}\""]
89
+ puts $/, ' ' << title.color(:red)
90
90
  puts drill.report
91
91
  end
92
92
  end
data/lib/tryouts.rb CHANGED
@@ -41,7 +41,7 @@ class Tryouts
41
41
  end
42
42
  end
43
43
 
44
- VERSION = "0.7.3"
44
+ VERSION = "0.7.4"
45
45
 
46
46
  require 'tryouts/mixins'
47
47
  require 'tryouts/tryout'
@@ -154,7 +154,11 @@ class Tryouts
154
154
  begin
155
155
  require @library.to_s
156
156
  rescue LoadError => ex
157
- @errors << ex.exception("Cannot load library: #{@library} (#{path})")
157
+ newex = Tryouts::Exception.new(ex.message)
158
+ trace = ex.backtrace
159
+ trace.unshift @paths.last
160
+ newex.set_backtrace trace
161
+ @errors << newex
158
162
  Tryouts.failed = true
159
163
  rescue SyntaxError, Exception, TypeError,
160
164
  RuntimeError, NoMethodError, NameError => ex
@@ -1,4 +1,4 @@
1
-
1
+ library :tryouts, 'lib'
2
2
 
3
3
  group "Mixins"
4
4
 
@@ -18,6 +18,6 @@ tryouts "Hash", :api do
18
18
  end
19
19
 
20
20
  drill "knows the deepest point", test_hash.deepest_point, 3
21
- drill "has a last method", {} #, :respond_to?, :last
21
+ drill "has a last method", {}, :respond_to?, :last
22
22
 
23
23
  end
data/tryouts.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "tryouts"
3
3
  s.rubyforge_project = "tryouts"
4
- s.version = "0.7.3"
4
+ s.version = "0.7.4"
5
5
  s.summary = "Tryouts are high-level tests for your Ruby code. May all your dreams come true!"
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delano-tryouts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum