Test/Context_test.rb in maroon-0.7.1 vs Test/Context_test.rb in maroon-0.8.0

- old
+ new

@@ -9,11 +9,11 @@ def test_role_method_call name = :MyContextRoleMethodCall role_name = :rol - c=Context::define name do + Context.define name do role role_name do def rolem(x, y) x+y end end @@ -24,24 +24,24 @@ assert_equal(7, MyContextRoleMethodCall.new.send(:self_rol_rolem, 3, 4)) assert_equal(7, MyContextRoleMethodCall.new.add(3, 4)) end - def xtest_simple + def test_simple name = :MyContextSimple role_name = :r - Context::define name do + Context.define name do role role_name do end end assert(Kernel::const_defined? name) end - def xtest_bind + def test_bind name = :MyContextBind - c= Context::define name do + c= Context.define name do role :role_name do def sum @sum += role_name end end @@ -56,53 +56,53 @@ end assert(Kernel::const_defined? name) assert_equal(3, MyContextBind.new.inter) end - def xtest_role_method + def test_role_method name = :MyContext role_name = :rol - Context::define name do + Context.define name do role role_name do def rolem 0+1 end end end assert_equal(1, MyContext.new.send(:self_rol_rolem)) end - def xtest_role_method_args + def test_role_method_args name = :MyContextArgs role_name = :rol - Context::define name do + Context.define name do role role_name do def rolem(x, y) x+y end end end assert_equal(7, MyContextArgs.new.send(:self_rol_rolem, 3, 4)) end - def xtest_role_method_splat + def test_role_method_splat name = :MyContextSplat role_name = :rol - Context::define name do + Context.define name do role role_name do def rolem(x, *args) x+(args[0]) end end end assert_equal(7, MyContextSplat.new.send(:self_rol_rolem, 3, 4)) end - def xtest_role_method_block + def test_role_method_block name = :MyContextBlock role_name = :rol - c= Context::define name do + c= Context.define name do role :num do def next num + 3 end end @@ -116,16 +116,16 @@ } res end end end - assert_equal(9, MyContextBlock.new.send(:self_rol_rolem, 3, 4) { |x, res| res + x }) + assert_equal(13, MyContextBlock.new.send(:self_rol_rolem, 3, 4) { |x, res| res + x }) end - def xtest_class_method_block + def test_class_method_block name = :MyContextClass role_name = :rol - Context::define name do + Context.define name do role :dummy do end role role_name do def rolem(*args, &b) res = 0 args.each { |x|