/vendor/gems/facets-2.4.5/test/more/test_metaid.rb
https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 39 lines · 20 code · 8 blank · 11 comment · 0 complexity · 0945959493118be9abed08f611f5f836 MD5 · raw file
- 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