dohtest 0.1.54 → 0.1.55
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_repeat +1 -0
- data/lib/dohtest/group_runner.rb +4 -0
- data/lib/dohtest/master_runner.rb +11 -0
- data/lib/dohtest/stream_output.rb +0 -3
- data/test/test_backtrace_parser.rb +1 -1
- data/test/test_exit_codes.rb +106 -0
- data/test/test_group_runner.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfbc04ce3b53966d24d062b84ba569837f0b31e4d3a2f62a6fd1dd3b034816fa
|
|
4
|
+
data.tar.gz: 693a91b6c27c0b262bd2313850b9cccdb67969cec40aaf2d9797cf159dd606fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 919fdd8ddd3a2e839d83ddda295340bb335842aa610c374da1938c2e73546608432b744dbd7636af5d727f570d3ad6754d0215e1fb9aba533bab7c2c7890b8fe
|
|
7
|
+
data.tar.gz: 30857a2fc0ab018f01e271e59186fb518e1485fed9b72d56236128663720c8df136eea427fc14771653a4b76c6cbeac24aa2cde209b18da80f86b9c4275682bc
|
data/bin/dohtest_repeat
CHANGED
data/lib/dohtest/group_runner.rb
CHANGED
|
@@ -26,19 +26,30 @@ class MasterRunner
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
total_problems = 0
|
|
29
|
+
total_assertions = 0
|
|
30
|
+
callbacks_succeeded = true
|
|
29
31
|
# sort them to be the same order no matter what (different machines were returning different results)
|
|
30
32
|
TestGroup.descendants.sort{|a,b|a.to_s<=>b.to_s}.shuffle.each do |group_class|
|
|
31
33
|
runner = GroupRunner.new(group_class, @output, @config)
|
|
32
34
|
brink_hit = runner.run
|
|
33
35
|
total_problems += runner.total_problems
|
|
36
|
+
total_assertions += runner.total_assertions
|
|
34
37
|
break if brink_hit
|
|
35
38
|
end
|
|
36
39
|
@config[:post_all_callback].each do |proc|
|
|
37
40
|
if !proc.call(total_problems)
|
|
41
|
+
callbacks_succeeded = false
|
|
38
42
|
@output.callback_failed(proc.inspect)
|
|
39
43
|
end
|
|
40
44
|
end
|
|
41
45
|
@output.run_end(Time.now - start_time)
|
|
46
|
+
|
|
47
|
+
success = (total_assertions > 0) && (total_problems == 0) && callbacks_succeeded
|
|
48
|
+
if success
|
|
49
|
+
return 0
|
|
50
|
+
else
|
|
51
|
+
return 1
|
|
52
|
+
end
|
|
42
53
|
end
|
|
43
54
|
end
|
|
44
55
|
|
|
@@ -72,9 +72,6 @@ class StreamOutput
|
|
|
72
72
|
msg = "#{error_str}; #{group_str}; #{test_str}; #{assertion_str}"
|
|
73
73
|
msg = colorize(:success, msg) if success
|
|
74
74
|
@std_ios.puts msg
|
|
75
|
-
|
|
76
|
-
# this is to generate an exit code; true translates to 0, false to 1
|
|
77
|
-
success
|
|
78
75
|
end
|
|
79
76
|
|
|
80
77
|
def group_begin(group_name)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
require 'dohroot'; Doh.find_root_from_file
|
|
2
|
+
require 'minitest/autorun'
|
|
3
|
+
require 'tmpdir'
|
|
4
|
+
|
|
5
|
+
module DohTest
|
|
6
|
+
|
|
7
|
+
# runs bin/dohtest and bin/dohtest_repeat as subprocesses against generated
|
|
8
|
+
# fixture suites, pinning the exit-code contract: 0 only when tests ran and
|
|
9
|
+
# every assertion passed, 1 otherwise
|
|
10
|
+
class TestExitCodes < Minitest::Test
|
|
11
|
+
BIN_DIR = File.join(Doh.root, 'bin')
|
|
12
|
+
LIB_DIR = File.join(Doh.root, 'lib')
|
|
13
|
+
|
|
14
|
+
PASSING_GROUP = <<~EOT
|
|
15
|
+
class TestExitPass < DohTest::TestGroup
|
|
16
|
+
def test_pass
|
|
17
|
+
assert_equal(4, 2 + 2)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
EOT
|
|
21
|
+
|
|
22
|
+
FAILING_GROUP = <<~EOT
|
|
23
|
+
class TestExitFail < DohTest::TestGroup
|
|
24
|
+
def test_pass
|
|
25
|
+
assert_equal(4, 2 + 2)
|
|
26
|
+
end
|
|
27
|
+
def test_fail
|
|
28
|
+
assert_equal(5, 2 + 2)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
EOT
|
|
32
|
+
|
|
33
|
+
ERROR_GROUP = <<~EOT
|
|
34
|
+
class TestExitError < DohTest::TestGroup
|
|
35
|
+
def test_error
|
|
36
|
+
raise 'boom'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
EOT
|
|
40
|
+
|
|
41
|
+
NO_ASSERTION_GROUP = <<~EOT
|
|
42
|
+
class TestExitNoAssertions < DohTest::TestGroup
|
|
43
|
+
def test_nothing
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
EOT
|
|
47
|
+
|
|
48
|
+
def run_dohtest(path)
|
|
49
|
+
system('ruby', "-I#{LIB_DIR}", File.join(BIN_DIR, 'dohtest'), '-q', path, :out => File::NULL, :err => File::NULL)
|
|
50
|
+
return $?.exitstatus
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def run_dohtest_repeat(path)
|
|
54
|
+
env = {'PATH' => "#{BIN_DIR}:#{ENV['PATH']}", 'RUBYLIB' => LIB_DIR}
|
|
55
|
+
system(env, 'ruby', File.join(BIN_DIR, 'dohtest_repeat'), '-q', path, :out => File::NULL, :err => File::NULL)
|
|
56
|
+
return $?.exitstatus
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def with_fixture(group_source)
|
|
60
|
+
Dir.mktmpdir do |dir|
|
|
61
|
+
File.write(File.join(dir, 'dohroot'), '')
|
|
62
|
+
path = File.join(dir, 'fixture.dt.rb')
|
|
63
|
+
File.write(path, group_source)
|
|
64
|
+
yield path
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_all_assertions_passing_exits_zero
|
|
69
|
+
with_fixture(PASSING_GROUP) do |path|
|
|
70
|
+
assert_equal(0, run_dohtest(path))
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_assertion_failure_exits_one
|
|
75
|
+
with_fixture(FAILING_GROUP) do |path|
|
|
76
|
+
assert_equal(1, run_dohtest(path))
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_error_exits_one
|
|
81
|
+
with_fixture(ERROR_GROUP) do |path|
|
|
82
|
+
assert_equal(1, run_dohtest(path))
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_no_assertions_exits_one
|
|
87
|
+
with_fixture(NO_ASSERTION_GROUP) do |path|
|
|
88
|
+
assert_equal(1, run_dohtest(path))
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def test_no_test_files_exits_one
|
|
93
|
+
Dir.mktmpdir do |dir|
|
|
94
|
+
File.write(File.join(dir, 'dohroot'), '')
|
|
95
|
+
assert_equal(1, run_dohtest(dir))
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def test_dohtest_repeat_propagates_failure
|
|
100
|
+
with_fixture(FAILING_GROUP) do |path|
|
|
101
|
+
assert_equal(1, run_dohtest_repeat(path))
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
data/test/test_group_runner.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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.55
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ATPSoft
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: dohroot
|
|
@@ -64,12 +63,12 @@ files:
|
|
|
64
63
|
- lib/dohtest/stream_output.rb
|
|
65
64
|
- lib/dohtest/test_group.rb
|
|
66
65
|
- test/test_backtrace_parser.rb
|
|
66
|
+
- test/test_exit_codes.rb
|
|
67
67
|
- test/test_group_runner.rb
|
|
68
68
|
homepage: https://github.com/atpsoft/dohtest
|
|
69
69
|
licenses:
|
|
70
70
|
- MIT
|
|
71
71
|
metadata: {}
|
|
72
|
-
post_install_message:
|
|
73
72
|
rdoc_options: []
|
|
74
73
|
require_paths:
|
|
75
74
|
- lib
|
|
@@ -84,10 +83,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
83
|
- !ruby/object:Gem::Version
|
|
85
84
|
version: '0'
|
|
86
85
|
requirements: []
|
|
87
|
-
rubygems_version:
|
|
88
|
-
signing_key:
|
|
86
|
+
rubygems_version: 4.0.17
|
|
89
87
|
specification_version: 4
|
|
90
88
|
summary: minimalist unit test framework
|
|
91
89
|
test_files:
|
|
92
90
|
- test/test_backtrace_parser.rb
|
|
91
|
+
- test/test_exit_codes.rb
|
|
93
92
|
- test/test_group_runner.rb
|