dohtest 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c3755cc11d5b29e1bb452676ebc60a9b067729f
4
- data.tar.gz: b7c39014b1dc4cc72bd720deba96262f7576c912
3
+ metadata.gz: 92492bd0677996b9e590fa75c1f1a818312a7670
4
+ data.tar.gz: 96943715e4ff50b23c805c8a1847e7e093368086
5
5
  SHA512:
6
- metadata.gz: 5a4ead9a33cbc1adae5eb3c4160ce8d2f85c33f257952e90b9b0b504f804102f0ddccba86e6ac40921fbc5404f9b1c22fa1c9faaccf9640e6a8e3c49af32df45
7
- data.tar.gz: 783180920d5995f0d8ac4141a06fd9acc83bba2404379ac3e214761a6065d2cb3bf1503d1477d8e6038f12bd1e46ee64f9a6edda829aaf22b937038aa98f41d6
6
+ metadata.gz: a589f97c5d3096bcb9aee58e15c41f63d241016c5d50caf4cac9914926be44dcc0879b57fee102aab250d1a052d769db75a09693aac944fb338ac45ed412188e
7
+ data.tar.gz: d8c7be13ad0cdc5d5524314ae694d016f9dd8d5ba996678757d547973e988032d0d14ea73bc474021f6fdbcca6cb11202fdb87f651fc050504fedf9785c94eaa
data/bin/dohtest CHANGED
@@ -9,6 +9,8 @@ opts = Doh::Options.new({
9
9
  'no_color' => [nil, '-c', '--no_color', "use this if you don't want ANSI color codes"],
10
10
  'verbose' => [nil, '-v', '--verbose', "use this to generate more output"],
11
11
  'quiet' => [nil, '-q', '--quiet', "use this to generate less output, disables ruby -v mode (which is default) "],
12
+ 'max_errors' => [0, '-e', '--max_errors', "stop tests after this many unexpected errors have happened; disabled by default"],
13
+ 'max_failures' => [0, '-f', '--max_failures', "stop tests after this many assertion failures have happened; disabled by default"],
12
14
  }, true, 'Files or directories may be specified to run tests on. Directories will be treated recursively. Defaults to the current directory.')
13
15
 
14
16
  #generates ruby warnings -- equivalent to ruby -v
@@ -23,5 +25,7 @@ DohTest.config[:seed] = opts.seed.to_i if opts.seed
23
25
  DohTest.config[:no_color] = true if opts.no_color
24
26
  DohTest.config[:verbose] = true if opts.verbose
25
27
  DohTest.config[:quiet] = true if opts.quiet
28
+ DohTest.config[:max_errors] = opts.max_errors
29
+ DohTest.config[:max_failures] = opts.max_failures
26
30
 
27
31
  exit DohTest::MasterRunner.new(DohTest::StreamOutput.new, DohTest.config, paths).run
@@ -4,7 +4,7 @@ module DohTest
4
4
  extend self
5
5
 
6
6
  def config
7
- @config ||= {}
7
+ @config ||= {:post_all_callback => []}
8
8
  end
9
9
 
10
10
  def find_root(start_directory, max_tries = 20)
@@ -112,17 +112,15 @@ class GroupRunner
112
112
  end
113
113
 
114
114
  def setup_brink
115
- if @config.key?(:max_errors) then
116
- @max_errors = @config[:max_errors].to_i
117
- end
118
- if @config.key?(:max_failures) then
119
- @max_failures = @config[:max_failures].to_i
120
- end
121
- @has_brink = @max_errors || @max_failures
115
+ @max_errors = @config[:max_errors].to_i
116
+ @max_failures = @config[:max_failures].to_i
117
+
118
+ @has_brink = (@max_errors > 0) || (@max_failures > 0)
122
119
  end
123
120
 
124
121
  def past_brink?
125
- (@max_errors && (@error_count > @max_errors)) || (@max_failures && (@assertions_failed > @max_failures))
122
+ ((@max_errors > 0) && (@error_count >= @max_errors)) ||
123
+ ((@max_failures > 0) && (@assertions_failed >= @max_failures))
126
124
  end
127
125
 
128
126
  def run_tests
@@ -28,9 +28,9 @@ class MasterRunner
28
28
  total_problems += runner.total_problems
29
29
  break if brink_hit
30
30
  end
31
- if @config[:post_all_callback]
32
- if (!@config[:post_all_callback].call(total_problems))
33
- @output.callback_failed(@config[:post_all_callback].inspect)
31
+ @config[:post_all_callback].each do |proc|
32
+ if !proc.call(total_problems)
33
+ @output.callback_failed(proc.inspect)
34
34
  end
35
35
  end
36
36
  @output.run_end(Time.now - start_time)
@@ -9,7 +9,7 @@ class StreamOutput
9
9
 
10
10
  def initialize(std_ios = nil, err_ios = nil)
11
11
  @error_count = @groups_ran = @groups_skipped = @tests_ran = @tests_skipped = @assertions_failed = @assertions_passed = 0
12
- @callback_succeeded = true
12
+ @callbacks_succeeded = true
13
13
  @badness = Set.new
14
14
  @std_ios = std_ios || $stdout
15
15
  @err_ios = err_ios || $stderr
@@ -64,7 +64,7 @@ class StreamOutput
64
64
  assertion_str = "#{total_assertions} assertions: #@assertions_passed passed, #{failed_str}"
65
65
  end
66
66
 
67
- success = (total_assertions > 0) && (@error_count == 0) && (@assertions_failed == 0) && @callback_succeeded
67
+ success = (total_assertions > 0) && (@error_count == 0) && (@assertions_failed == 0) && @callbacks_succeeded
68
68
 
69
69
  msg = "#{error_str}; #{group_str}; #{test_str}; #{assertion_str}"
70
70
  msg = colorize(:success, msg) if success
@@ -115,9 +115,9 @@ class StreamOutput
115
115
  display_badness(group_name, test_name, failure)
116
116
  end
117
117
 
118
- def callback_failed(test_name)
119
- @callback_succeeded = false
120
- @err_ios.puts colorize(:error, "callback #{test_name} failed")
118
+ def callback_failed(proc_name)
119
+ @callbacks_succeeded = false
120
+ @err_ios.puts colorize(:error, "callback #{proc_name} failed")
121
121
  end
122
122
 
123
123
  def assertion_passed(group_name, test_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dohtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
4
+ version: 0.1.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makani Mason
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-24 00:00:00.000000000 Z
12
+ date: 2013-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dohroot