Class: L::Test::TargetTestCase

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

Instance Method Summary collapse

Methods inherited from TargetTest

#build_self

Methods inherited from R::Target

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

Constructor Details

#initialize(klass, t) ⇒ TargetTestCase

Returns a new instance of TargetTestCase.



211
212
213
214
215
216
217
218
# File 'lib/rub/l/test.rb', line 211

def initialize(klass, t)
  @tag = t.to_sym
  @klass = klass
  
  klass.rub_target = self
  
  super()
end

Instance Method Details

#inputObject



203
204
205
# File 'lib/rub/l/test.rb', line 203

def input
  @klass.rub_get_dependancies
end

#outputObject



207
208
209
# File 'lib/rub/l/test.rb', line 207

def output
  Set[@tag]
end

#run_tests(reporter, options) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/rub/l/test.rb', line 220

def run_tests(reporter, options)
  out = StringIO.new("", "w")
  options = {
    io:      out,
    verbose: true
  }
  pr = Reporter.new(options)
  reporter << pr
  
  @klass.run reporter, options
  
  reporter.reporters.delete pr
  
  bs = R::BuildStep.new
  bs.desc = "Running test case :#{@tag}"
  bs.out  = out.string
  bs.status = pr.passed? ? 0 : 1
  bs.print
end