Browse Source

+ t/m3u.t

master
Alex 'AdUser' Z 10 years ago
parent
commit
3e33c15682
  1. 40
      t/m3u.t

40
t/m3u.t

@ -0,0 +1,40 @@
#!/usr/bin/perl
use strict;
use warnings;
use lib 'lib';
use POSIX qw(tmpnam);
use Test::More tests => 3;
require_ok('Playlist::M3U');
my $pls = new_ok('Playlist::M3U' => []);
my $path = tmpnam();
open my $FH, ">", $path;
print $FH <<EOF;
#EXTM3U aspect-ratio=4:3
#EXTINF:-1 cn-id=10338245,First channel
http://127.0.0.1:1027/udp/224.3.22.7:1234
#EXTINF:-1 cn-id=34727751,Second channel +8
http://127.0.0.1:1027/udp/224.3.23.9:1234
EOF
close $FH;
my $out = [{
attrs => { 'cn-id' => '10338245' },
file => 'http://127.0.0.1:1027/udp/224.3.22.7:1234',
title => 'First channel',
duration => '-1',
}, {
attrs => { 'cn-id' => '34727751' },
file => 'http://127.0.0.1:1027/udp/224.3.23.9:1234',
title => 'Second channel +8',
duration => '-1',
}];
is_deeply(scalar $pls->load($path), $out, "Loading test playlist");
unlink $path;
exit 0;
Loading…
Cancel
Save