dohtest 0.1.51 → 0.1.52

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: c65ae8542671d9a70fcb9712dc9de692ba6d379d
4
- data.tar.gz: b6a395e6f1ffb9977760d8941da898f9b68ce7b3
3
+ metadata.gz: a3829322dbd582038ad299b99fdf60f6c5efb97c
4
+ data.tar.gz: 71fb6741be4f451b02d85e194dfd250b228e04d2
5
5
  SHA512:
6
- metadata.gz: 581310decdb8a8e6c0d9a1feb9837ba4d3aae2e71009d628629c2da49a124bd13230470e0a592c2a97efb83a4b07d258757b471599ba233479ce763dc88c1890
7
- data.tar.gz: 9261d2a26d5144a7cfffa99bda033b06e2f5bf2a1be6e971f51a287fb3a08595a1af3f0de1fe62b3f5148a53bed40e79ad972bcfa584afd4ee3857b4dc2c3d36
6
+ metadata.gz: ddcd101ea8d3fdc89745e72878a046c75d9d08b72fc55bdbc35a63d69f4cdc22bb61b034cbfe1157855b2ee69a4a6125f6c0f3338301bb6320dfa7b39cf69223
7
+ data.tar.gz: 8a3e0f4cdfbdf558177e53f2bf2d707e4dee242ed80e11540e65b2850ad14fd906c6d2669d49c95dfd742b3d1feaa4f68176bf30d232606fc41aa66c4ceb522c
@@ -1,4 +1,5 @@
1
1
  require 'dohroot'
2
+ require 'dohtest/find_files'
2
3
 
3
4
  module DohTest
4
5
  extend self
@@ -59,8 +60,17 @@ def add_default_config_values
59
60
  DohTest.config[:seed] ||= (Time.new.to_f * 1000).to_i
60
61
  end
61
62
 
63
+ def set_test_files
64
+ paths = DohTest.config[:paths]
65
+ if paths.empty?
66
+ paths = ['.']
67
+ end
68
+ DohTest.config[:test_files] = DohTest.find_test_files(DohTest.config[:glob], paths)
69
+ end
70
+
62
71
  def configure(start_path)
63
72
  add_default_config_values
73
+ set_test_files
64
74
  load_configuration_file(start_path)
65
75
  end
66
76
 
@@ -0,0 +1,17 @@
1
+ module DohTest
2
+ extend self
3
+
4
+ def find_files(glob, paths)
5
+ retval = []
6
+ expanded_paths = paths.map {|path| File.expand_path(path) }
7
+ expanded_paths.each do |path|
8
+ if File.directory?(path)
9
+ retval.concat(Dir.glob(File.join(path, '**', glob)).to_a)
10
+ else
11
+ retval << path
12
+ end
13
+ end
14
+ return retval
15
+ end
16
+
17
+ end
@@ -0,0 +1,18 @@
1
+ module DohTest
2
+ extend self
3
+
4
+ def require_test_file(path, callbacks)
5
+ callbacks.each do |callback|
6
+ callback.call(path)
7
+ end
8
+ require(path)
9
+ end
10
+
11
+ def load_test_files(paths)
12
+ callbacks = @config[:pre_require_callback]
13
+ paths.each do |path|
14
+ require_test_file(path, callbacks)
15
+ end
16
+ end
17
+
18
+ end
@@ -1,5 +1,5 @@
1
1
  require 'dohtest/group_runner'
2
- require 'dohtest/require_paths'
2
+ require 'dohtest/load_test_files'
3
3
 
4
4
  module DohTest
5
5
 
@@ -14,15 +14,13 @@ class MasterRunner
14
14
  srand(@config[:seed])
15
15
  @output.run_begin(@config)
16
16
 
17
- paths = @config[:paths]
18
- if paths.empty?
19
- paths = ['.']
20
- end
21
- if !DohTest.require_paths(@config[:glob], paths)
17
+ if @config[:test_files].empty?
22
18
  @output.no_tests_found
23
19
  return 1
24
20
  end
25
21
 
22
+ DohTest.load_test_files(@config[:test_files])
23
+
26
24
  @config[:pre_test_callback].each do |callback|
27
25
  callback.call(@output)
28
26
  end
@@ -16,9 +16,11 @@ class StreamOutput
16
16
  end
17
17
 
18
18
  def run_begin(config)
19
- @config = config
20
- @std_ios.puts "running tests with config: #{config}"
19
+ display_config = config.dup
20
+ display_config.delete(:test_files)
21
+ @std_ios.puts "running tests with config: #{display_config}"
21
22
 
23
+ @config = config
22
24
  has_terminal = @std_ios.tty?
23
25
  @no_color = !has_terminal || @config[:no_color]
24
26
  @verbose = (has_terminal && !@config[:quiet]) || @config[:verbose]
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.51
4
+ version: 0.1.52
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: 2017-12-22 00:00:00.000000000 Z
12
+ date: 2017-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dohroot
@@ -58,9 +58,10 @@ files:
58
58
  - lib/dohtest/capture_output.rb
59
59
  - lib/dohtest/configure.rb
60
60
  - lib/dohtest/failure.rb
61
+ - lib/dohtest/find_files.rb
61
62
  - lib/dohtest/group_runner.rb
63
+ - lib/dohtest/load_test_files.rb
62
64
  - lib/dohtest/master_runner.rb
63
- - lib/dohtest/require_paths.rb
64
65
  - lib/dohtest/stream_output.rb
65
66
  - lib/dohtest/test_group.rb
66
67
  - test/test_backtrace_parser.rb
@@ -1,29 +0,0 @@
1
- module DohTest
2
- extend self
3
-
4
- def require_test_file(path, callbacks)
5
- callbacks.each do |callback|
6
- callback.call(path)
7
- end
8
- require(path)
9
- end
10
-
11
- def require_paths(glob, paths)
12
- retval = false
13
- expanded_paths = paths.map {|path| File.expand_path(path) }
14
- callbacks = @config[:pre_require_callback]
15
- expanded_paths.each do |path|
16
- if File.directory?(path)
17
- Dir.glob(File.join(path, '**', glob)).each do |filename|
18
- retval = true
19
- DohTest.require_test_file(filename, callbacks)
20
- end
21
- else
22
- retval = true
23
- DohTest.require_test_file(path, callbacks)
24
- end
25
- end
26
- return retval
27
- end
28
-
29
- end