Class: L::Test::TargetTest

Inherits:
R::Target show all
Defined in:
lib/rub/l/test.rb

Direct Known Subclasses

TargetTestCase

Instance Method Summary collapse

Methods inherited from R::Target

#build, #clean?, #description, #hash_input, #hash_output, #hash_outputs, #hash_self, #register

Constructor Details

#initializeTargetTest

Returns a new instance of TargetTest.



162
163
164
165
166
# File 'lib/rub/l/test.rb', line 162

def initialize
	super()
	
	register
end

Instance Method Details

#build_selfObject



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/rub/l/test.rb', line 176

def build_self
	out = StringIO.new("", "w")

	options = {
		io:      out,
		verbose: true
	}

	reporter = Minitest::CompositeReporter.new
	reporter << Minitest::SummaryReporter.new(options[:io], options)
	
	reporter.start
	out.string = '' # We don't want the start text.
	
	run_tests reporter, options
	reporter.report
	
	bs = R::BuildStep.new
	bs.desc = "Test Results"
	bs.status = reporter.passed? ? 0 : 1
	bs.out = out.string
	bs.print
end

#inputObject



150
151
152
153
154
155
156
# File 'lib/rub/l/test.rb', line 150

def input
	Minitest::Runnable.runnables.map do |r|
		r.rub_target
	end.compact.map do |t|
		t.input.to_a
	end.flatten.to_set
end

#outputObject



158
159
160
# File 'lib/rub/l/test.rb', line 158

def output
	Set[:test]
end

#run_tests(reporter, options) ⇒ Object



168
169
170
171
172
173
174
# File 'lib/rub/l/test.rb', line 168

def run_tests(reporter, options)
	Minitest::Runnable.runnables.each do |r|
		r.rub_target or next
		
		r.rub_target.run_tests reporter, options
	end
end