You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
58 lines
1.2 KiB
#!/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;
|
|
|