Browse Source

+ t/xspf.t

master
Alex 'AdUser' Z 10 years ago
parent
commit
66963c603b
  1. 58
      t/xspf.t

58
t/xspf.t

@ -0,0 +1,58 @@
#!/usr/bin/perl
use strict;
use warnings;
use lib 'lib';
use POSIX qw(tmpnam);
use Test::More tests => 3;
require_ok('Playlist::XSPF');
my $xspf = new_ok('Playlist::XSPF' => []);
my $path = tmpnam();
open my $FH, ">", $path;
print $FH <<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<title>Windows Path</title>
<location>file:///C:/music/foo.mp3</location>
</track>
<track>
<title>Linux Path</title>
<location>file:///media/music/foo.mp3</location>
</track>
<track>
<title>Relative Path</title>
<location>music/foo.mp3</location>
</track>
<track>
<title>External Example</title>
<location>http://www.example.com/music/bar.ogg</location>
</track>
</trackList>
</playlist>
EOF
close $FH;
my $out = [{
location => 'file:///C:/music/foo.mp3',
title => 'Windows Path',
}, {
title => 'Linux Path',
location => 'file:///media/music/foo.mp3',
}, {
title => 'Relative Path',
location => 'music/foo.mp3',
}, {
title => 'External Example',
location => 'http://www.example.com/music/bar.ogg',
}];
is_deeply(scalar $xspf->load($path), $out, "Loading test playlist");
unlink $path;
exit 0;
Loading…
Cancel
Save