예제 #1
0
  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);
  }
예제 #2
0
 // '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;
 }
예제 #3
0
 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));
 }
예제 #4
0
 // '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;
 }