File: 39_load_type.t

package info (click to toggle)
libxml-feedpp-perl 0.95-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 400 kB
  • sloc: perl: 1,877; sh: 28; makefile: 2
file content (37 lines) | stat: -rwxr-xr-x 1,165 bytes parent folder | download
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
# ----------------------------------------------------------------
    use strict;
    use Test::More tests => 6;
    BEGIN { use_ok('XML::FeedPP') };
# ----------------------------------------------------------------
{
    local $@;
    my $source = '<dummy></dummy>';
    eval { XML::FeedPP->new( $source ); };
    like( $@, qr/Invalid feed source/, 'Invalid XML auto' );
}
{
    local $@;
    my $source = 'dummy string';
    eval { XML::FeedPP->new( $source ); };
    like( $@, qr/Invalid feed source/, 'Invalid string auto' );
}
{
    local $@;
    my $source = '<dummy></dummy>';
    eval { XML::FeedPP->new( $source, -type => 'string' ); };
    like( $@, qr/Invalid.*feed format/, 'Invalid XML type' );
}
{
    local $@;
    my $source = 'dummy string';
    eval { XML::FeedPP->new( $source, -type => 'string' ); };
    like( $@, qr/Loading failed/, 'Invalid string type' );
}
{
    local $@;
    my $source = 'dummy filename';
    eval { XML::FeedPP->new( $source, -type => 'file' ); };
#   like( $@, qr/No such file or directory/, 'Invalid filename' );
    ok( $@, 'Invalid filename' );
}
# ----------------------------------------------------------------