示例#1
0
  void test_initialize() {
    String *pat = String::create(state, ".");
    Regexp* re = Regexp::create(state);
    re->initialize(state, pat, Fixnum::from(0));

    TS_ASSERT_EQUALS(re->source(), pat);
    TS_ASSERT_EQUALS(re->names(),  cNil);
  }
示例#2
0
  void test_create_with_named_captures() {
    String *pat = String::create(state, "(?<blah>.)");
    Regexp* re = Regexp::create(state);
    re->initialize(state, pat, Fixnum::from(0));

    TS_ASSERT_EQUALS(re->source(), pat);
    TS_ASSERT(re->names()->kind_of_p(state, G(lookuptable)));
  }
示例#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));
 }