Class: Testdata::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/testdata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s) ⇒ Unit

Returns a new instance of Unit.



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/testdata.rb', line 329

def initialize(s)

  super()
  @a = []

  buffer, _ = RXFReader.read(s)

  @doc = Rexle.new(buffer)

  @doc.root.xpath('records/test').map do |test|

    path, type, description = test.xpath('summary/*/text()')
    records = test.element('records')

    inputs = records.xpath('input/summary/*').map\
                                        {|x| [x.name, x.texts.join.strip]}

    outputs = records.xpath('output/summary/*').map\
                                        {|x| [x.name, x.texts.join.strip]}

    @a << {type: type, in: inputs, out: outputs}

  end

end

Instance Attribute Details

#to_sObject (readonly)

end of initialize()



355
356
357
# File 'lib/testdata.rb', line 355

def to_s
  @to_s
end