void test_allocate() { Class* sub = ontology::new_class(state, "RegexpSub", G(regexp), 0); Regexp* re = Regexp::allocate(state, sub); TS_ASSERT_EQUALS(re->klass(), sub); }
// 'self' is passed in automatically by the primitive glue Regexp* Regexp::allocate(STATE, Object* self) { Regexp* re = Regexp::create(state); re->onig_data = 0; re->klass(state, (Class*)self); return re; }
void test_create() { Regexp* re = Regexp::create(state); TS_ASSERT(re->source()->nil_p()); TS_ASSERT(re->names()->nil_p()); TS_ASSERT_EQUALS(re->klass(), G(regexp)); }
// 'self' is passed in automatically by the primitive glue Regexp* Regexp::allocate(STATE, Object* self) { Regexp* re = Regexp::create(state); re->onig_data = NULL; re->klass(state, as<Class>(self)); return re; }