Sha256: c66d488acd2fea73de7eb4eab4a9ef205326c423eace9fe4e246d59eeffcdf43

Contents?: true

Size: 819 Bytes

Versions: 10

Compression:

Stored size: 819 Bytes

Contents

require 'facets/metaid.rb'
require 'test/unit'

class TestMetaid < Test::Unit::TestCase

  def test_metaclass
    o = Object.new
    assert_equal( (class << o; self; end), o.metaclass )
  end

  def test_meta_class
    o = Object.new
    assert_equal( (class << o; self; end), o.meta_class )
  end

  #def test_singleton
  #  o = Object.new
  #  assert_equal( (class << o; self; end), o.singleton )
  #end

  #def test_singleton_eval
  #  assert_nothing_raised do
  #    o.singleton_class_eval{ @@a = "test" }
  #  end
  #end

  #def test_singleton_method
  #  assert_nothing_raised do
  #    o.define_singleton_method(:testing){ |x| x + 1 }
  #  end
  #  assert_equal(2, o.testing(1) )
  #end

  #def test_singleton_class
  #  o = Object.new
  #  assert_equal( (class << o; self; end), o.singleton_class )
  #end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/test_metaid.rb
facets-2.8.3 test/core/test_metaid.rb
facets-2.8.2 test/core/test_metaid.rb
facets-2.8.1 test/core/test_metaid.rb
facets-2.8.0 test/core/test_metaid.rb
facets-2.7.0 test/core/test_metaid.rb
facets-2.6.0 test/core/test_metaid.rb
facets-2.5.1 test/core/test_metaid.rb
facets-2.5.0 test/core/test_metaid.rb
facets-2.5.2 test/core/test_metaid.rb