my $fixed = 'The scalar remains the same'; $_ = $fixed; */ $ra = new Regexp_Assemble(); is_deeply($ra->__mbegin, [], 'mbegin is [] on non-tracked R::A object'); is_deeply($ra->__mend, [], 'mend is [] on non-tracked R::A object'); $re = new Regexp_Assemble(); $re->add('cat')->add('dog'); $regexp = $re->re(); ok($re->match('cat'), 'match without tracking'); ok(!$re->match('eagle'), 'match fail without tracking'); $re = new Regexp_Assemble(); $re->track(1)->add('dog'); ok($re->match('dog'), 're pattern-0 dog match'); is($re->source(0), 'dog', 'source is dog'); $re = new Regexp_Assemble(['track' => 1]); $re->add('dog', 'dogged', 'fish', 'fetish', 'flash', 'fresh'); $re->add('foolish-\\d+'); ok($re->match('dog'), 're pattern-1 dog match'); // SKIP: { // skip( "matched() is not implemented in this version of perl ($])", 1 ) if $PERL_VERSION_TOO_LOW; is($re->matched, 'dog', 're pattern-1 dog matched'); // } ok($re->match('dogged'), 're pattern-1 dogged match'); // SKIP: { // skip( "matched() is not implemented in this version of perl ($])", 1 ) if $PERL_VERSION_TOO_LOW; is($re->matched, 'dogged', 're pattern-1 dogged matched'); // } ok($re->match('fetish'), 're pattern-1 fetish match'); // SKIP: {
exit 0; } use constant NR_GOOD => 45; use constant NR_BAD => 529; use constant NR_ERROR => 0; my $fixed = 'The scalar remains the same'; $_ = $fixed; */ $ra = new Regexp_Assemble(); $ra->add('foo', 'bar', 'rat'); foreach (array('unfooled', 'disembark', 'vibration') as $target) { like($target, "/{$ra}/", "match ok {$target}"); } ok(!$ra->source(), 'source() undefined'); foreach (array('unfooled', 'disembark', 'vibration') as $target) { unlike($target, "/^{$ra}/", "anchored match not ok {$target}"); } $ra->reset(); foreach (array('unfooled', 'disembark', 'vibration') as $target) { unlike($target, "/{$ra}/", "fail after reset {$target}"); } $ra->add('who', 'what', 'where', 'why', 'when'); foreach (array('unfooled', 'disembark', 'vibration') as $target) { unlike($target, "/{$ra}/", "fail ok {$target}"); } foreach (array('snowhouse', 'somewhat', 'nowhereness', 'whyever', 'nowhence') as $target) { like($target, "/{$ra}/", "new match ok {$target}"); } $ra->reset()->mutable(1);