## # Module ISO Test def labeled_module(name, &block) Module.new do (class <", Module.new.to_s assert_match "#", Class.new.to_s end assert('Module#inspect') do module Test4to_sModules end assert_equal 'Test4to_sModules', Test4to_sModules.inspect end assert('Issue 1467') do module M1 def initialize() super() end end class C1 include M1 def initialize() super() end end class C2 include M1 end C1.new C2.new end assert('clone Module') do module M1 def foo true end end class B include M1.clone end B.new.foo end assert('Module#module_function') do module M def modfunc; end module_function :modfunc end assert_true M.respond_to?(:modfunc) end assert('module with non-class/module outer raises TypeError') do assert_raise(TypeError) { module 0::M1 end } assert_raise(TypeError) { module []::M2 end } end assert('module to return the last value') do m = module M; :m end assert_equal(m, :m) end assert('module to return nil if body is empty') do assert_nil(module M end) end assert('get constant of parent module in singleton class; issue #3568') do actual = module GetConstantInSingletonTest EXPECTED = "value" class << self EXPECTED end end assert_equal("value", actual) end