piko-max-mod 0.0.1
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 +7 -0
- data/piko-max-mod.gemspec +12 -0
- data/test-unit-3.7.8/BSDL +24 -0
- data/test-unit-3.7.8/COPYING +64 -0
- data/test-unit-3.7.8/PSFL +271 -0
- data/test-unit-3.7.8/README.md +108 -0
- data/test-unit-3.7.8/Rakefile +74 -0
- data/test-unit-3.7.8/bin/test-unit +5 -0
- data/test-unit-3.7.8/doc/text/getting-started.md +120 -0
- data/test-unit-3.7.8/doc/text/how-to.md +90 -0
- data/test-unit-3.7.8/doc/text/news.md +2070 -0
- data/test-unit-3.7.8/lib/test/unit/assertion-failed-error.rb +60 -0
- data/test-unit-3.7.8/lib/test/unit/assertions.rb +2536 -0
- data/test-unit-3.7.8/lib/test/unit/attribute-matcher.rb +26 -0
- data/test-unit-3.7.8/lib/test/unit/attribute.rb +228 -0
- data/test-unit-3.7.8/lib/test/unit/auto-runner-loader.rb +17 -0
- data/test-unit-3.7.8/lib/test/unit/autorunner.rb +654 -0
- data/test-unit-3.7.8/lib/test/unit/code-snippet-fetcher.rb +58 -0
- data/test-unit-3.7.8/lib/test/unit/collector/descendant.rb +20 -0
- data/test-unit-3.7.8/lib/test/unit/collector/dir.rb +110 -0
- data/test-unit-3.7.8/lib/test/unit/collector/load.rb +201 -0
- data/test-unit-3.7.8/lib/test/unit/collector/objectspace.rb +35 -0
- data/test-unit-3.7.8/lib/test/unit/collector/xml.rb +249 -0
- data/test-unit-3.7.8/lib/test/unit/collector.rb +104 -0
- data/test-unit-3.7.8/lib/test/unit/color-scheme.rb +225 -0
- data/test-unit-3.7.8/lib/test/unit/color.rb +134 -0
- data/test-unit-3.7.8/lib/test/unit/data-sets.rb +127 -0
- data/test-unit-3.7.8/lib/test/unit/data.rb +371 -0
- data/test-unit-3.7.8/lib/test/unit/diff.rb +745 -0
- data/test-unit-3.7.8/lib/test/unit/error.rb +158 -0
- data/test-unit-3.7.8/lib/test/unit/exception-handler.rb +82 -0
- data/test-unit-3.7.8/lib/test/unit/failure.rb +169 -0
- data/test-unit-3.7.8/lib/test/unit/fault-location-detector.rb +104 -0
- data/test-unit-3.7.8/lib/test/unit/fixture.rb +304 -0
- data/test-unit-3.7.8/lib/test/unit/notification.rb +138 -0
- data/test-unit-3.7.8/lib/test/unit/omission.rb +198 -0
- data/test-unit-3.7.8/lib/test/unit/pending.rb +155 -0
- data/test-unit-3.7.8/lib/test/unit/priority.rb +194 -0
- data/test-unit-3.7.8/lib/test/unit/process-test-result.rb +55 -0
- data/test-unit-3.7.8/lib/test/unit/process-worker.rb +87 -0
- data/test-unit-3.7.8/lib/test/unit/runner/console.rb +86 -0
- data/test-unit-3.7.8/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit-3.7.8/lib/test/unit/runner/xml.rb +15 -0
- data/test-unit-3.7.8/lib/test/unit/sub-test-result.rb +59 -0
- data/test-unit-3.7.8/lib/test/unit/test-process-run-context.rb +21 -0
- data/test-unit-3.7.8/lib/test/unit/test-run-context.rb +16 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-creator.rb +103 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-process-runner.rb +205 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-runner.rb +132 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-thread-runner.rb +96 -0
- data/test-unit-3.7.8/lib/test/unit/test-thread-run-context.rb +23 -0
- data/test-unit-3.7.8/lib/test/unit/testcase.rb +1058 -0
- data/test-unit-3.7.8/lib/test/unit/testresult.rb +132 -0
- data/test-unit-3.7.8/lib/test/unit/testsuite.rb +133 -0
- data/test-unit-3.7.8/lib/test/unit/ui/console/outputlevel.rb +15 -0
- data/test-unit-3.7.8/lib/test/unit/ui/console/testrunner.rb +891 -0
- data/test-unit-3.7.8/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit-3.7.8/lib/test/unit/ui/testrunner.rb +53 -0
- data/test-unit-3.7.8/lib/test/unit/ui/testrunnermediator.rb +131 -0
- data/test-unit-3.7.8/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit-3.7.8/lib/test/unit/ui/xml/testrunner.rb +225 -0
- data/test-unit-3.7.8/lib/test/unit/util/backtracefilter.rb +65 -0
- data/test-unit-3.7.8/lib/test/unit/util/memory-usage.rb +47 -0
- data/test-unit-3.7.8/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit-3.7.8/lib/test/unit/util/observable.rb +86 -0
- data/test-unit-3.7.8/lib/test/unit/util/output.rb +32 -0
- data/test-unit-3.7.8/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit-3.7.8/lib/test/unit/version.rb +5 -0
- data/test-unit-3.7.8/lib/test/unit/warning.rb +3 -0
- data/test-unit-3.7.8/lib/test/unit/worker-context.rb +20 -0
- data/test-unit-3.7.8/lib/test/unit.rb +521 -0
- data/test-unit-3.7.8/lib/test-unit.rb +19 -0
- data/test-unit-3.7.8/sample/adder.rb +13 -0
- data/test-unit-3.7.8/sample/subtracter.rb +12 -0
- data/test-unit-3.7.8/sample/test_adder.rb +20 -0
- data/test-unit-3.7.8/sample/test_subtracter.rb +20 -0
- data/test-unit-3.7.8/sample/test_user.rb +23 -0
- metadata +117 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
require_relative 'util/backtracefilter'
|
|
2
|
+
|
|
3
|
+
module Test
|
|
4
|
+
module Unit
|
|
5
|
+
class Pending
|
|
6
|
+
include Util::BacktraceFilter
|
|
7
|
+
attr_reader :test_name, :location, :message
|
|
8
|
+
attr_reader :method_name
|
|
9
|
+
|
|
10
|
+
SINGLE_CHARACTER = 'P'
|
|
11
|
+
LABEL = "Pending"
|
|
12
|
+
|
|
13
|
+
# Creates a new Pending with the given location and
|
|
14
|
+
# message.
|
|
15
|
+
def initialize(test_name, location, message, options={})
|
|
16
|
+
@test_name = test_name
|
|
17
|
+
@location = location
|
|
18
|
+
@message = message
|
|
19
|
+
@method_name = options[:method_name]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Returns a single character representation of a pending.
|
|
23
|
+
def single_character_display
|
|
24
|
+
SINGLE_CHARACTER
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def label
|
|
28
|
+
LABEL
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Returns a brief version of the error description.
|
|
32
|
+
def short_display
|
|
33
|
+
"#{@test_name}: #{@message.split("\n")[0]}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns a verbose version of the error description.
|
|
37
|
+
def long_display
|
|
38
|
+
backtrace = filter_backtrace(location).join("\n")
|
|
39
|
+
"#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Overridden to return long_display.
|
|
43
|
+
def to_s
|
|
44
|
+
long_display
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def critical?
|
|
48
|
+
true
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class PendedError < StandardError
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
module TestCasePendingSupport
|
|
57
|
+
class << self
|
|
58
|
+
def included(base)
|
|
59
|
+
base.class_eval do
|
|
60
|
+
include PendingHandler
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Marks the test or part of the test is pending.
|
|
66
|
+
#
|
|
67
|
+
# Example:
|
|
68
|
+
#
|
|
69
|
+
# def test_pending
|
|
70
|
+
# pend
|
|
71
|
+
# # Not reached here
|
|
72
|
+
# end
|
|
73
|
+
#
|
|
74
|
+
# def test_pending_with_here
|
|
75
|
+
# pend do
|
|
76
|
+
# # Ran here
|
|
77
|
+
# # Fails if the block doesn't raise any error.
|
|
78
|
+
# # Because it means the block is passed unexpectedly.
|
|
79
|
+
# end
|
|
80
|
+
# # Reached here
|
|
81
|
+
# end
|
|
82
|
+
def pend(message=nil, &block)
|
|
83
|
+
message ||= "pended."
|
|
84
|
+
if block_given?
|
|
85
|
+
pending = nil
|
|
86
|
+
begin
|
|
87
|
+
yield
|
|
88
|
+
rescue Exception
|
|
89
|
+
pending = Pending.new(name, filter_backtrace(caller), message,
|
|
90
|
+
:method_name => @method_name)
|
|
91
|
+
add_pending(pending)
|
|
92
|
+
end
|
|
93
|
+
unless pending
|
|
94
|
+
flunk("Pending block should not be passed: #{message}")
|
|
95
|
+
end
|
|
96
|
+
else
|
|
97
|
+
raise PendedError.new(message)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
private
|
|
102
|
+
def add_pending(pending)
|
|
103
|
+
problem_occurred
|
|
104
|
+
current_result.add_pending(pending)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
module PendingHandler
|
|
109
|
+
class << self
|
|
110
|
+
def included(base)
|
|
111
|
+
base.exception_handler(:handle_pended_error)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
private
|
|
116
|
+
def handle_pended_error(exception)
|
|
117
|
+
return false unless exception.is_a?(PendedError)
|
|
118
|
+
pending = Pending.new(name,
|
|
119
|
+
filter_backtrace(exception.backtrace),
|
|
120
|
+
exception.message,
|
|
121
|
+
:method_name => @method_name)
|
|
122
|
+
add_pending(pending)
|
|
123
|
+
true
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
module TestResultPendingSupport
|
|
128
|
+
attr_reader :pendings
|
|
129
|
+
|
|
130
|
+
# Records a Test::Unit::Pending.
|
|
131
|
+
def add_pending(pending)
|
|
132
|
+
@pendings << pending
|
|
133
|
+
notify_fault(pending)
|
|
134
|
+
notify_changed
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Returns the number of pendings this TestResult has
|
|
138
|
+
# recorded.
|
|
139
|
+
def pending_count
|
|
140
|
+
@pendings.size
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
private
|
|
144
|
+
def initialize_containers
|
|
145
|
+
super
|
|
146
|
+
@pendings = []
|
|
147
|
+
@summary_generators << :pending_summary
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def pending_summary
|
|
151
|
+
"#{pending_count} pendings"
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
module Test
|
|
2
|
+
module Unit
|
|
3
|
+
module Priority
|
|
4
|
+
class << self
|
|
5
|
+
def included(base)
|
|
6
|
+
base.extend(ClassMethods)
|
|
7
|
+
|
|
8
|
+
base.class_eval do
|
|
9
|
+
setup :priority_setup, :before => :prepend
|
|
10
|
+
teardown :priority_teardown, :after => :append
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
@@enabled = false
|
|
15
|
+
def enabled?
|
|
16
|
+
@@enabled
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def enable
|
|
20
|
+
require "fileutils"
|
|
21
|
+
require "tmpdir"
|
|
22
|
+
@@enabled = true
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def disable
|
|
26
|
+
@@enabled = false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
@@default = :normal
|
|
30
|
+
def default
|
|
31
|
+
@@default || :normal
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def default=(default)
|
|
35
|
+
@@default = default
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def available_values
|
|
39
|
+
Checker.available_priorities
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class Checker
|
|
44
|
+
class << self
|
|
45
|
+
def have_priority?(name)
|
|
46
|
+
singleton_class = (class << self; self; end)
|
|
47
|
+
singleton_class.method_defined?(priority_check_method_name(name))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def need_to_run?(test)
|
|
51
|
+
priority = test[:priority] || Priority.default
|
|
52
|
+
if have_priority?(priority)
|
|
53
|
+
__send__(priority_check_method_name(priority), test)
|
|
54
|
+
else
|
|
55
|
+
true
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def available_priorities
|
|
60
|
+
methods(false).collect do |name|
|
|
61
|
+
/\Arun_priority_(.+)\?\z/ =~ name.to_s
|
|
62
|
+
$1
|
|
63
|
+
end.compact
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def run_priority_must?(test)
|
|
67
|
+
true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def run_priority_important?(test)
|
|
71
|
+
rand > 0.1
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def run_priority_high?(test)
|
|
75
|
+
rand > 0.3
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def run_priority_normal?(test)
|
|
79
|
+
rand > 0.5
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def run_priority_low?(test)
|
|
83
|
+
rand > 0.75
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def run_priority_never?(test)
|
|
87
|
+
false
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
private
|
|
91
|
+
def priority_check_method_name(priority_name)
|
|
92
|
+
"run_priority_#{priority_name}?"
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
attr_reader :test
|
|
97
|
+
def initialize(test)
|
|
98
|
+
@test = test
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def setup
|
|
102
|
+
FileUtils.rm_f(passed_file)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def teardown
|
|
106
|
+
if @test.__send__(:passed?)
|
|
107
|
+
FileUtils.touch(passed_file)
|
|
108
|
+
else
|
|
109
|
+
FileUtils.rm_f(passed_file)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def need_to_run?
|
|
114
|
+
!previous_test_success? or self.class.need_to_run?(@test)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
private
|
|
118
|
+
def previous_test_success?
|
|
119
|
+
File.exist?(passed_file)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def result_dir
|
|
123
|
+
components = [
|
|
124
|
+
".test-result",
|
|
125
|
+
escape_class_name(@test.class.name || "AnonymousTestCase"),
|
|
126
|
+
escaped_method_name,
|
|
127
|
+
]
|
|
128
|
+
parent_directories = [File.dirname($0), Dir.pwd]
|
|
129
|
+
if Process.respond_to?(:uid)
|
|
130
|
+
parent_directories << File.join(Dir.tmpdir, Process.uid.to_s)
|
|
131
|
+
end
|
|
132
|
+
parent_directories.each do |parent_directory|
|
|
133
|
+
dir = File.expand_path(File.join(parent_directory, *components))
|
|
134
|
+
begin
|
|
135
|
+
FileUtils.mkdir_p(dir)
|
|
136
|
+
return dir
|
|
137
|
+
rescue Errno::EACCES
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
raise Errno::EACCES, parent_directories.join(", ")
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def passed_file
|
|
145
|
+
File.join(result_dir, "passed")
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def escape_class_name(class_name)
|
|
149
|
+
escape_name(class_name)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def escaped_method_name
|
|
153
|
+
escape_name(@test.method_name.to_s)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def escape_name(name)
|
|
157
|
+
name.gsub(/(?:[: \/!?=])/) do |matched|
|
|
158
|
+
case matched
|
|
159
|
+
when ":"
|
|
160
|
+
"_colon_"
|
|
161
|
+
when " ", "/"
|
|
162
|
+
"_"
|
|
163
|
+
when "!"
|
|
164
|
+
".destructive"
|
|
165
|
+
when "?"
|
|
166
|
+
".predicate"
|
|
167
|
+
when "="
|
|
168
|
+
".equal"
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
module ClassMethods
|
|
175
|
+
def priority(name, *tests)
|
|
176
|
+
unless Checker.have_priority?(name)
|
|
177
|
+
raise ArgumentError, "unknown priority: #{name}"
|
|
178
|
+
end
|
|
179
|
+
attribute(:priority, name, {:keep => true}, *tests)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def priority_setup(&_)
|
|
184
|
+
return unless Priority.enabled?
|
|
185
|
+
Checker.new(self).setup
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def priority_teardown
|
|
189
|
+
return unless Priority.enabled?
|
|
190
|
+
Checker.new(self).teardown
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#--
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tsutomu Katsube.
|
|
4
|
+
# Copyright:: Copyright (c) 2025 Tsutomu Katsube. All rights reserved.
|
|
5
|
+
# License:: Ruby license.
|
|
6
|
+
|
|
7
|
+
module Test
|
|
8
|
+
module Unit
|
|
9
|
+
class ProcessTestResult
|
|
10
|
+
def initialize(output)
|
|
11
|
+
@output = output
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def add_run
|
|
15
|
+
send_result(__method__)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def add_pass
|
|
19
|
+
send_result(__method__)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Records an individual assertion.
|
|
23
|
+
def add_assertion
|
|
24
|
+
send_result(__method__)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def add_error(error)
|
|
28
|
+
send_result(__method__, error)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def add_failure(failure)
|
|
32
|
+
send_result(__method__, failure)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def add_pending(pending)
|
|
36
|
+
send_result(__method__, pending)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def add_omission(omission)
|
|
40
|
+
send_result(__method__, omission)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def add_notification(notification)
|
|
44
|
+
send_result(__method__, notification)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def send_result(action, *args)
|
|
50
|
+
Marshal.dump({status: :result, action: action, args: args}, @output)
|
|
51
|
+
@output.flush
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#--
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tsutomu Katsube.
|
|
4
|
+
# Copyright:: Copyright (c) 2025 Tsutomu Katsube. All rights reserved.
|
|
5
|
+
# License:: Ruby license.
|
|
6
|
+
|
|
7
|
+
require "optparse"
|
|
8
|
+
require "socket"
|
|
9
|
+
|
|
10
|
+
parser = OptionParser.new
|
|
11
|
+
load_paths = []
|
|
12
|
+
parser.on("--load-path=PATH") do |path|
|
|
13
|
+
load_paths << path
|
|
14
|
+
end
|
|
15
|
+
base_directory = nil
|
|
16
|
+
parser.on("--base-directory=PATH") do |path|
|
|
17
|
+
base_directory = path
|
|
18
|
+
end
|
|
19
|
+
worker_id = nil
|
|
20
|
+
parser.on("--worker-id=ID", Integer) do |id|
|
|
21
|
+
worker_id = id
|
|
22
|
+
end
|
|
23
|
+
remote_ip_address = nil
|
|
24
|
+
parser.on("--ip-address=ADDRESS") do |address|
|
|
25
|
+
remote_ip_address = address
|
|
26
|
+
end
|
|
27
|
+
remote_ip_port = nil
|
|
28
|
+
parser.on("--ip-port=PORT", Integer) do |port|
|
|
29
|
+
remote_ip_port = port
|
|
30
|
+
end
|
|
31
|
+
test_paths = parser.parse!
|
|
32
|
+
$LOAD_PATH.unshift(*load_paths)
|
|
33
|
+
|
|
34
|
+
require_relative "../unit"
|
|
35
|
+
require_relative "collector/load"
|
|
36
|
+
require_relative "process-test-result"
|
|
37
|
+
require_relative "worker-context"
|
|
38
|
+
Test::Unit::AutoRunner.need_auto_run = false
|
|
39
|
+
collector = Test::Unit::Collector::Load.new
|
|
40
|
+
collector.base = base_directory
|
|
41
|
+
suite = collector.collect(*test_paths)
|
|
42
|
+
|
|
43
|
+
io_open = lambda do |&block|
|
|
44
|
+
if Gem.win_platform?
|
|
45
|
+
TCPSocket.open(remote_ip_address, remote_ip_port) do |data_socket|
|
|
46
|
+
Marshal.dump(Process.pid, data_socket)
|
|
47
|
+
data_socket.flush
|
|
48
|
+
block.call(data_socket, data_socket)
|
|
49
|
+
end
|
|
50
|
+
else
|
|
51
|
+
IO.open(Test::Unit::TestSuiteProcessRunner::MAIN_TO_WORKER_INPUT_FILENO) do |data_input|
|
|
52
|
+
IO.open(Test::Unit::TestSuiteProcessRunner::WORKER_TO_MAIN_OUTPUT_FILENO) do |data_output|
|
|
53
|
+
block.call(data_input, data_output)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
io_open.call do |data_input, data_output|
|
|
60
|
+
loop do
|
|
61
|
+
Marshal.dump({status: :ready}, data_output)
|
|
62
|
+
data_output.flush
|
|
63
|
+
test_name = Marshal.load(data_input)
|
|
64
|
+
break if test_name.nil?
|
|
65
|
+
test = suite.find(test_name)
|
|
66
|
+
result = Test::Unit::ProcessTestResult.new(data_output)
|
|
67
|
+
run_context = Test::Unit::TestRunContext.new(Test::Unit::TestSuiteRunner)
|
|
68
|
+
|
|
69
|
+
event_listener = lambda do |event_name, *args|
|
|
70
|
+
Marshal.dump({status: :event, event_name: event_name, args: args}, data_output)
|
|
71
|
+
data_output.flush
|
|
72
|
+
end
|
|
73
|
+
if test.is_a?(Test::Unit::TestSuite)
|
|
74
|
+
test_suite = test
|
|
75
|
+
else
|
|
76
|
+
test_suite = Test::Unit::TestSuite.new(test.class.name, test.class)
|
|
77
|
+
test_suite << test
|
|
78
|
+
end
|
|
79
|
+
runner = Test::Unit::TestSuiteRunner.new(test_suite)
|
|
80
|
+
worker_context = Test::Unit::WorkerContext.new(worker_id, run_context, result)
|
|
81
|
+
runner.run(worker_context, &event_listener)
|
|
82
|
+
end
|
|
83
|
+
Marshal.dump({status: :done}, data_output)
|
|
84
|
+
data_output.flush
|
|
85
|
+
|
|
86
|
+
Marshal.load(data_input)
|
|
87
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Copyright (C) 2008-2023 Sutou Kouhei <kou@clear-code.com>
|
|
2
|
+
|
|
3
|
+
module Test
|
|
4
|
+
module Unit
|
|
5
|
+
AutoRunner.register_runner(:console) do |auto_runner|
|
|
6
|
+
require_relative '../ui/console/testrunner'
|
|
7
|
+
Test::Unit::UI::Console::TestRunner
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
AutoRunner.setup_option do |auto_runner, opts|
|
|
11
|
+
require_relative '../ui/console/outputlevel'
|
|
12
|
+
require_relative '../ui/console/testrunner'
|
|
13
|
+
|
|
14
|
+
output_levels = [
|
|
15
|
+
["silent", UI::Console::OutputLevel::SILENT],
|
|
16
|
+
["progress", UI::Console::OutputLevel::PROGRESS_ONLY],
|
|
17
|
+
["important-only", UI::Console::OutputLevel::IMPORTANT_FAULTS_ONLY],
|
|
18
|
+
["normal", UI::Console::OutputLevel::NORMAL],
|
|
19
|
+
["verbose", UI::Console::OutputLevel::VERBOSE],
|
|
20
|
+
]
|
|
21
|
+
opts.on('-v', '--verbose=[LEVEL]', output_levels,
|
|
22
|
+
"Set the output level (default is normal).",
|
|
23
|
+
"(#{auto_runner.keyword_display(output_levels)})") do |level|
|
|
24
|
+
level ||= output_levels.assoc("verbose")[1]
|
|
25
|
+
auto_runner.runner_options[:output_level] = level
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
use_color_options = [
|
|
29
|
+
[:auto, :auto],
|
|
30
|
+
["-", false],
|
|
31
|
+
["no", false],
|
|
32
|
+
["false", false],
|
|
33
|
+
["+", true],
|
|
34
|
+
["yes", true],
|
|
35
|
+
["true", true],
|
|
36
|
+
]
|
|
37
|
+
opts.on("--[no-]use-color=[auto]", use_color_options,
|
|
38
|
+
"Uses color output",
|
|
39
|
+
"(default is auto)") do |use_color|
|
|
40
|
+
case use_color
|
|
41
|
+
when nil
|
|
42
|
+
use_color = true
|
|
43
|
+
when :auto
|
|
44
|
+
use_color = nil
|
|
45
|
+
end
|
|
46
|
+
auto_runner.runner_options[:use_color] = use_color
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
opts.on("--progress-row-max=MAX", Integer,
|
|
50
|
+
"Uses MAX as max terminal width for progress mark",
|
|
51
|
+
"(default is auto)") do |max|
|
|
52
|
+
auto_runner.runner_options[:progress_row_max] = max
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
progress_styles = [
|
|
56
|
+
["inplace", :inplace],
|
|
57
|
+
["mark", :mark],
|
|
58
|
+
["fault-only", :fault_only],
|
|
59
|
+
]
|
|
60
|
+
opts.on("--progress-style=STYLE", progress_styles,
|
|
61
|
+
"Uses STYLE as progress style",
|
|
62
|
+
"(#{auto_runner.keyword_display(progress_styles)})") do |style|
|
|
63
|
+
auto_runner.runner_options[:progress_style] = style
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
opts.on("--no-show-detail-immediately",
|
|
67
|
+
"Shows not passed test details immediately.",
|
|
68
|
+
"(default is yes)") do |boolean|
|
|
69
|
+
auto_runner.runner_options[:show_detail_immediately] = boolean
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
opts.on("--[no-]reverse-output",
|
|
73
|
+
"Shows fault details in reverse.",
|
|
74
|
+
"(default is yes for tty output, no otherwise)") do |boolean|
|
|
75
|
+
auto_runner.runner_options[:reverse_output] = boolean
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
n_report_slow_tests = UI::Console::TestRunner::N_REPORT_SLOW_TESTS
|
|
79
|
+
opts.on("--[no-]report-slow-tests",
|
|
80
|
+
"Shows the top #{n_report_slow_tests} slow tests in the summary output",
|
|
81
|
+
"(false)") do |boolean|
|
|
82
|
+
auto_runner.runner_options[:report_slow_tests] = boolean
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Test
|
|
2
|
+
module Unit
|
|
3
|
+
AutoRunner.register_runner(:xml) do |auto_runner|
|
|
4
|
+
require_relative '../ui/xml/testrunner'
|
|
5
|
+
Test::Unit::UI::XML::TestRunner
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
AutoRunner.setup_option do |auto_runner, opts|
|
|
9
|
+
opts.on("--output-file-descriptor=FD", Integer,
|
|
10
|
+
"Outputs to file descriptor FD") do |fd|
|
|
11
|
+
auto_runner.runner_options[:output_file_descriptor] = fd
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#--
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tsutomu Katsube.
|
|
4
|
+
# Copyright:: Copyright (c) 2024 Tsutomu Katsube. All rights reserved.
|
|
5
|
+
# License:: Ruby license.
|
|
6
|
+
|
|
7
|
+
module Test
|
|
8
|
+
module Unit
|
|
9
|
+
class SubTestResult
|
|
10
|
+
attr_accessor :stop_tag
|
|
11
|
+
|
|
12
|
+
def initialize(parent_test_result)
|
|
13
|
+
@parent_test_result = parent_test_result
|
|
14
|
+
@stop_tag = nil
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def add_run(result=self)
|
|
18
|
+
@parent_test_result.add_run(result)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def add_pass
|
|
22
|
+
@parent_test_result.add_pass
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Records an individual assertion.
|
|
26
|
+
def add_assertion
|
|
27
|
+
@parent_test_result.add_assertion
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def add_error(error)
|
|
31
|
+
@parent_test_result.add_error(error)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def add_failure(failure)
|
|
35
|
+
@parent_test_result.add_failure(failure)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def add_pending(pending)
|
|
39
|
+
@parent_test_result.add_pending(pending)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def add_omission(omission)
|
|
43
|
+
@parent_test_result.add_omission(omission)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def add_notification(notification)
|
|
47
|
+
@parent_test_result.add_notification(notification)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def passed?
|
|
51
|
+
@parent_test_result.passed?
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def stop
|
|
55
|
+
throw @stop_tag
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#--
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tsutomu Katsube.
|
|
4
|
+
# Copyright:: Copyright (c) 2025 Tsutomu Katsube. All rights reserved.
|
|
5
|
+
# License:: Ruby license.
|
|
6
|
+
|
|
7
|
+
require_relative "test-run-context"
|
|
8
|
+
|
|
9
|
+
module Test
|
|
10
|
+
module Unit
|
|
11
|
+
class TestProcessRunContext < TestRunContext
|
|
12
|
+
attr_reader :test_names
|
|
13
|
+
attr_accessor :progress_block
|
|
14
|
+
def initialize(runner_class)
|
|
15
|
+
super(runner_class)
|
|
16
|
+
@test_names = []
|
|
17
|
+
@progress_block = nil
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#--
|
|
2
|
+
#
|
|
3
|
+
# Author:: Tsutomu Katsube.
|
|
4
|
+
# Copyright:: Copyright (c) 2025 Tsutomu Katsube. All rights reserved.
|
|
5
|
+
# License:: Ruby license.
|
|
6
|
+
|
|
7
|
+
module Test
|
|
8
|
+
module Unit
|
|
9
|
+
class TestRunContext
|
|
10
|
+
attr_reader :runner_class
|
|
11
|
+
def initialize(runner_class)
|
|
12
|
+
@runner_class = runner_class
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|