test/test_Module.cpp in rice-1.2.0 vs test/test_Module.cpp in rice-1.3.0

- old
+ new

@@ -177,16 +177,16 @@ } TESTCASE(define_singleton_method_int_foo) { Module m(anonymous_module()); - m.define_singleton_method("foo", define_method_int_foo_helper); + m.define_singleton_method("int_and_foo", define_method_int_foo_helper); define_method_int_result = 0; Foo * foo = new Foo; foo->x = 1024; VALUE f = Data_Wrap_Struct(rb_cObject, 0, Default_Allocation_Strategy<Foo>::free, foo); - m.call("foo", 42, Object(f)); + m.call("int_and_foo", 42, Object(f)); ASSERT_EQUAL(42, define_method_int_foo_result_i); ASSERT_EQUAL(foo, define_method_int_foo_result_x); } // TODO: how to test define_iterator? @@ -424,5 +424,30 @@ m.call("foo", "test"); ASSERT_EQUAL("test", with_defaults_and_references_x); ASSERT(!with_defaults_and_references_doIt); } + +/* +namespace { + float with_reference_defaults_x; + std::string with_reference_defaults_str; + + void with_reference_defaults(float x, std::string const& str = std::string("testing")) + { + with_reference_defaults_x = x; + with_reference_defaults_str = str; + } +} + +TESTCASE(define_method_works_with_reference_const_default_values) +{ + Module m(anonymous_module()); + m.define_module_function("bar", &with_reference_defaults, + (Arg("x"), Arg("str") = std::string("testing"))); + + m.call("bar", 3); + + ASSERT_EQUAL(3, with_reference_defaults_x); + ASSERT_EQUAL("testing", with_reference_defaults_str); +} +*/