Ejemplo n.º 1
0
is($red->as_string(), 'dig', 'mute dig 2');
$r = new Regexp_Assemble();
is($r->add('ab', 'cd')->as_string(['indent' => 0]), '(?:ab|cd)', 'indent 0');
$r = new Regexp_Assemble();
is($r->add('dldrt', 'dndrt', 'dldt', 'dndt', 'dx')->as_string(['indent' => 3]), 'd
(?:
   [ln]dr?t
   |x
)', 'dldrt dndrt dldt dndt dx (indent 3)');
$r = new Regexp_Assemble(['indent' => 2]);
is($r->add('foo', 'bar')->as_string(), '(?:
  bar
  |foo
)', 'pretty foo bar');
$r = new Regexp_Assemble();
is($r->indent(2)->add('food', 'fool', 'bar')->as_string(), '(?:
  foo[dl]
  |bar
)', 'pretty food fool bar');
$r = new Regexp_Assemble();
is($r->add('afood', 'afool', 'abar')->indent(2)->as_string(), 'a
(?:
  foo[dl]
  |bar
)', 'pretty afood afool abar');
$r = new Regexp_Assemble();
is($r->add('dab', 'dam', 'day')->as_string(['indent' => 2]), 'da[bmy]', 'pretty dab dam day');
$r = new Regexp_Assemble(['indent' => 5]);
is($r->add('be', 'bed')->as_string(['indent' => 2]), 'bed?', 'pretty be bed');
$r = new Regexp_Assemble(['indent' => 5]);
is($r->add('b-d', 'b\\.d')->as_string(['indent' => 2]), 'b[-.]d', 'pretty b-d b\\.d');