dohtest 0.1.26 → 0.1.27
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 +4 -4
- data/bin/dohtest +2 -2
- data/lib/dohtest/configure.rb +34 -14
- data/lib/dohtest/master_runner.rb +8 -1
- data/lib/dohtest/require_paths.rb +8 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1fdf2db3fe1625dbaa12e7c08465abd3494b5d4
|
4
|
+
data.tar.gz: 10ea4118de3da5152355c6c7e930dc8db16e7271
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ab77e357128d6635947f09611543d4b7eb22ee48d044e8860d7994293ab52d8207c22d583d14e95ae815e6cdcb0974e04c548d792db014280f65e62f8b6814
|
7
|
+
data.tar.gz: bd7949258961d19fab200e89efeed2b44721d7307ec040cd52eead405aa43bec98013cd15bdb2f3e2b34bc60d54e149db6ff5dcaf67519d5215bacd1f4c90594
|
data/bin/dohtest
CHANGED
@@ -14,9 +14,9 @@ opts = Doh::Options.new({
|
|
14
14
|
#generates ruby warnings -- equivalent to ruby -v
|
15
15
|
$VERBOSE = true unless opts.quiet
|
16
16
|
|
17
|
-
paths =
|
17
|
+
paths = opts.varargs
|
18
18
|
|
19
|
-
DohTest.configure(paths
|
19
|
+
DohTest.configure(paths.first)
|
20
20
|
DohTest.config[:grep] = opts.grep if opts.grep
|
21
21
|
DohTest.config[:glob] = opts.glob if opts.glob
|
22
22
|
DohTest.config[:seed] = opts.seed.to_i if opts.seed
|
data/lib/dohtest/configure.rb
CHANGED
@@ -1,38 +1,58 @@
|
|
1
|
-
require 'dohroot'
|
2
|
-
|
3
1
|
module DohTest
|
2
|
+
extend self
|
4
3
|
|
5
|
-
def
|
4
|
+
def config
|
6
5
|
@config ||= {}
|
7
6
|
end
|
8
7
|
|
9
|
-
def
|
10
|
-
|
8
|
+
def find_root(start_directory, max_tries = 20)
|
9
|
+
curr_directory = start_directory
|
10
|
+
max_tries.times do
|
11
|
+
return nil if curr_directory == '/'
|
12
|
+
if File.directory?(File.join(curr_directory, 'test'))
|
13
|
+
return curr_directory
|
14
|
+
end
|
15
|
+
curr_directory = File.expand_path(File.join(curr_directory, '..'))
|
16
|
+
end
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_configuration_files(start_path)
|
21
|
+
start_path = File.expand_path(start_path || '.')
|
11
22
|
if File.directory?(start_path)
|
12
23
|
start_directory = start_path
|
13
24
|
else
|
14
25
|
start_directory = File.dirname(start_path)
|
15
26
|
end
|
16
|
-
root_directory =
|
27
|
+
root_directory = find_root(start_directory)
|
28
|
+
raise "unable to determine root directory to run tests from" unless root_directory
|
29
|
+
DohTest.config[:root] = root_directory
|
17
30
|
|
18
|
-
|
19
|
-
if
|
20
|
-
|
31
|
+
libdir = File.join(root_directory, 'lib')
|
32
|
+
if File.directory?(libdir) && !$LOAD_PATH.include?(libdir)
|
33
|
+
$LOAD_PATH << libdir
|
34
|
+
end
|
35
|
+
|
36
|
+
cfgfile = File.join(root_directory, 'dohtest.rb')
|
37
|
+
if File.exist?(cfgfile)
|
38
|
+
require(cfgfile)
|
21
39
|
return
|
22
40
|
end
|
23
41
|
|
24
|
-
|
25
|
-
|
26
|
-
require(
|
42
|
+
cfgfile = File.join(root_directory, 'config', 'dohtest.rb')
|
43
|
+
if File.exist?(cfgfile)
|
44
|
+
require(cfgfile)
|
45
|
+
return
|
27
46
|
end
|
47
|
+
|
28
48
|
end
|
29
49
|
|
30
|
-
def
|
50
|
+
def add_default_config_values
|
31
51
|
DohTest.config[:glob] ||= '*.dt.rb'
|
32
52
|
DohTest.config[:seed] ||= (Time.new.to_f * 1000).to_i
|
33
53
|
end
|
34
54
|
|
35
|
-
def
|
55
|
+
def configure(start_path)
|
36
56
|
load_configuration_files(start_path)
|
37
57
|
add_default_config_values
|
38
58
|
end
|
@@ -11,7 +11,14 @@ class MasterRunner
|
|
11
11
|
def run
|
12
12
|
start_time = Time.now
|
13
13
|
@config[:pre_test_callback].call(@output) if @config[:pre_test_callback]
|
14
|
-
|
14
|
+
if @paths.empty?
|
15
|
+
unless DohTest.require_paths(@config[:glob], ['.'])
|
16
|
+
DohTest.require_paths(@config[:glob], [@config[:root]])
|
17
|
+
end
|
18
|
+
else
|
19
|
+
DohTest.require_paths(@config[:glob], @paths)
|
20
|
+
end
|
21
|
+
|
15
22
|
srand(@config[:seed])
|
16
23
|
@output.run_begin(@config)
|
17
24
|
total_problems = 0
|
@@ -1,13 +1,19 @@
|
|
1
1
|
module DohTest
|
2
|
+
extend self
|
2
3
|
|
3
|
-
def
|
4
|
+
def require_paths(glob, paths)
|
5
|
+
retval = false
|
4
6
|
paths.collect {|elem| File.expand_path(elem) }.each do |onepath|
|
5
7
|
if File.directory?(onepath)
|
6
|
-
Dir.glob(File.join(onepath, '**', glob)).each
|
8
|
+
Dir.glob(File.join(onepath, '**', glob)).each do |filename|
|
9
|
+
retval = true
|
10
|
+
require(filename)
|
11
|
+
end
|
7
12
|
else
|
8
13
|
require(File.expand_path(onepath))
|
9
14
|
end
|
10
15
|
end
|
16
|
+
retval
|
11
17
|
end
|
12
18
|
|
13
19
|
end
|
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.
|
4
|
+
version: 0.1.27
|
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-
|
12
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dohroot
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.1.8
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: minimalist unit test framework
|