123456789_123456789_123456789_123456789_123456789_

Class: Test::Unit::Data::ClassMethods::Loader

Relationships & Source Files
Inherits: Object
Defined in: lib/test/unit/data.rb

Instance Method Summary

Instance Method Details

#normalize_value(value) (private)

[ GitHub ]

  
# File 'lib/test/unit/data.rb', line 230

def normalize_value(value)
  return true if value == "true"
  return false if value == "false"
  begin
    Integer(value)
  rescue ArgumentError
    begin
      Float(value)
    rescue ArgumentError
      value
    end
  end
end

#set_test_data(header, row) (private)

[ GitHub ]

  
# File 'lib/test/unit/data.rb', line 244

def set_test_data(header, row)
  label = row.shift
  if header
    data = {}
    header.each_with_index do |key, i|
      data[key] = normalize_value(row[i])
    end
  else
    data = row.collect do |cell|
      normalize_value(cell)
    end
  end
  @test_case.data(label, data)
end