Locale-TextDomain-OO-Extract
view release on metacpan or search on metacpan
t/01_debug.t view on Meta::CPAN
#!perl -T
use strict;
use warnings;
use Test::More;
BEGIN {
$ENV{AUTHOR_TESTING}
or plan skip_all => 'Author test. Set $ENV{AUTHOR_TESTING} to a true value to run.';
}
use Test::NoWarnings;
use Test::Differences;
BEGIN {
plan tests => 4;
use_ok 'Locale::TextDomain::OO::Extract::Base::RegexBasedExtractor';
}
my $text_rule
= [
# 'text with 0 .. n escaped chars'
qr{
\s* ( ['] )
(
[^\\']* # normal text
(?: \\ . [^\\']* )* # maybe followed by escaped char and normal text
)
[']
}xms,
];
my $start_rule = qr{ loc_ \( }xms;
my $rules = [
'begin',
qr{ \b loc_ \s* [(] }xms,
'and',
$text_rule,
'end',
];
sub _chomp ($) {
local $_ = shift;
chomp;
return $_;
};
my @expected_debug = (
[
'stack start',
_chomp(<<'EOT'),
$stack = [
{
start_pos => 1
}
];
EOT
],
[
'rules start',
'0: Starting at pos 1.',
],
[
'rules begin',
'0: Begin.',
],
[
'rules current pos',
'0: Set the current pos to 1.',
],
( run in 0.888 second using v1.01-cache-2.11-cpan-39bf76dae61 )