#!/usr/bin/perl use strict; use lib "blib/lib"; use Regexp::Common qw /RE_comment_HTML/; use t::Common qw /run_new_tests cross/; use warnings; my @good = ("", "This is a comment", "This is - a comment", "This is - - comment", ">This is a comment", ">This is a comment<", "This is comment", ">", "<>", "><", "<"); my @spec = ("", ">", "->", " [0], ss, $_ -> [1], ss, $_ -> [2], ss]} cross \@spec, \@spec, \@spec; # Targets, and test suites. my %targets; my @tests; $targets {simple} = { list => \@good, query => sub {""}, wanted => sub {$_, ""}, }; $targets {simple_space} = { list => \@spaced, query => sub {""}, wanted => sub {$_, ""}, }; $targets {crossed2} = { list => \@cross3, query => sub {"", # Missing ! "", # Not enough dashes, "", # Too many starting dashes. "", # Space after ", # Garbage after comment )} @good; $targets {bad1} = { list => \@bad, }; $targets {bad2} = { list => \@crossed, query => sub {""}, }; push @tests => { name => 'HTML', regex => $RE {comment} {HTML}, pass => [qw /simple simple_space crossed crossed2/], fail => [qw /bad1 bad2/], sub => \&RE_comment_HTML, }; run_new_tests tests => \@tests, targets => \%targets, version_from => 'Regexp::Common::comment', ; __END__