Sha256: 72bb3f525a8872da02336a8280d878e795ff6efe5afeef06d309d3c6dc2f59cb

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require 'test/unit'

require 'eymiha'


class TC_object < Test::Unit::TestCase

  def test_raise
    assert_raise(TypeError) { raise_no_conversion(self,true) }
  end

end


class TC_hash < Test::Unit::TestCase

  def setup
    @hash1 = { 1 => 'one' }
    @hash2 = { [ :common ] => { 'time' => 'money' } }
    @hash3 = { :elements => [ :earth, :air, :fire, :water] }
    @hash4 = { 2 => 'two', 3=> 'three' }
  end

  def test_to_s
    assert(@hash1.to_s == "{ 1 => one }")
    assert(@hash2.to_s == "{ [ common ] => { time => money } }")
    assert(@hash3.to_s == "{ elements => [ earth, air, fire, water ] }")
    s = @hash4.to_s
    assert((s == "{ 2 => two, 3 => three }") ||
           (s == "{ 3 => three, 2 => two }"))
  end

end
  

class TC_array < Test::Unit::TestCase

  def setup
    @array = [  1, 'one', { 'time' => 'money' },
      :elements, [ :earth, :air, :fire, :water] ]
  end

  def test_to_s
    assert(@array.to_s == "[ 1, one, { time => money }, elements, [ earth, air, fire, water ] ]")
  end

end


class TC_class_name < Test::Unit::TestCase
  
  def test_class_name
    assert(class_name == "TC_class_name")
    assert(self.class.class_name == "TC_class_name")
    assert("foo".class_name == "String")
    assert(String.class_name == "String")
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eymiha-1.0.0 test/tc_eymiha.rb