File: parse_line.t

package info (click to toggle)
libtext-vfile-asdata-perl 0.08-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 292 kB
  • sloc: perl: 771; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 566 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w
use strict;
use Test::More;
use Text::ParseWords ();
use Text::vFile::asData ();


if (eval "require Test::Differences") {
    no warnings 'redefine';
    *is_deeply = \&Test::Differences::eq_or_diff;
}

sub same {
    is_deeply( [[ Text::vFile::asData::parse_line( @_ ) ]],
               [[ Text::ParseWords::parse_line( @_ ) ]],
               "same( " .( join ", ", map { "'$_'" } @_ ) ." )");
}

for my $string ( 'foo', 'foo:', 'foo:bar', 'foo:bar:' ) {
    for my $keep (0, 1) {
        same( ':', $keep, $string );
    }
}

done_testing();