1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
use Test::More tests => 3;
BEGIN { use_ok('Text::Quoted') };
use Data::Dumper;
my $text = <<EOF;
foo
============
bar
============
baz
EOF
is_deeply(extract($text), [
{text => 'foo', quoter => '', raw => 'foo'},
{text => '============', quoter => '', raw => '============', separator => 1 },
{text => 'bar', quoter => '', raw => 'bar'},
{text => '============', quoter => '', raw => '============', separator => 1 },
{text => 'baz', quoter => '', raw => 'baz'},
],
"Sample text is organized properly"
) or diag Dumper(extract($text));
$text = <<EOF;
foo
> bar
> ============
> baz
> ============
EOF
is_deeply(extract($text), [
{text => 'foo', quoter => '', raw => 'foo'},
[
{text => 'bar', quoter => '>', raw => '> bar'},
{text => '============', quoter => '>', raw => '> ============', separator => 1 },
{text => 'baz', quoter => '>', raw => '> baz'},
{text => '============', quoter => '>', raw => '> ============', separator => 1 },
],
],
"Sample text is organized properly"
) or diag Dumper(extract($text));
|