Acme-AsciiArtinator

 view release on metacpan or  search on metacpan

t/19-tokenize-regex.t  view on Meta::CPAN

$code = 's#cat(s?)#dogs#g';
@tokens = Acme::AsciiArtinator::tokenize_code($code);
ok(@tokens == 2, "regex modifier is separate token");

$code = 's/(fox)/$hound.$1.$dog/ge';
@tokens = Acme::AsciiArtinator::tokenize_code($code);
ok(@tokens > 2, "s///e makes 2nd pattern flexible");

$code = 'm{C A T}';
@tokens = Acme::AsciiArtinator::tokenize_code($code);
ok(@tokens == 1, "whitespace in default regex is not flexible");

$code = 'm{C A T}gx';
@tokens = Acme::AsciiArtinator::tokenize_code($code);
ok(@tokens == 6, "whitespace in /regex/x is flexible");

$code = 's/C A T scanning machine/$&x17/gexms;$q+=4;';
@tokens = Acme::AsciiArtinator::tokenize_code($code);
ok(@tokens == 32, "whitespace,2nd expr in s///xe are flexible");

$code = 's{C A T}{$&x17}xe';



( run in 0.383 second using v1.01-cache-2.11-cpan-0a6323c29d9 )