File: separator.t

package info (click to toggle)
libtext-quoted-perl 2.09-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 192 kB
  • ctags: 122
  • sloc: perl: 1,518; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (4)
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));