PageRenderTime 22ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/metaid.rb'
  2. require 'test/unit'
  3. class TestMetaid < Test::Unit::TestCase
  4. def test_metaclass
  5. o = Object.new
  6. assert_equal( (class << o; self; end), o.metaclass )
  7. end
  8. def test_meta_class
  9. o = Object.new
  10. assert_equal( (class << o; self; end), o.meta_class )
  11. end
  12. def test_singleton
  13. o = Object.new
  14. assert_equal( (class << o; self; end), o.singleton )
  15. end
  16. #def test_singleton_eval
  17. # assert_nothing_raised do
  18. # o.singleton_class_eval{ @@a = "test" }
  19. # end
  20. #end
  21. #def test_singleton_method
  22. # assert_nothing_raised do
  23. # o.define_singleton_method(:testing){ |x| x + 1 }
  24. # end
  25. # assert_equal(2, o.testing(1) )
  26. #end
  27. def test_singleton_class
  28. o = Object.new
  29. assert_equal( (class << o; self; end), o.singleton_class )
  30. end
  31. end