From 66963c603b2ea70271265f2e88a3beec812586bf Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 8 Apr 2015 12:59:12 +1000 Subject: [PATCH] + t/xspf.t --- t/xspf.t | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 t/xspf.t diff --git a/t/xspf.t b/t/xspf.t new file mode 100644 index 0000000..7131473 --- /dev/null +++ b/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 < + + + + Windows Path + file:///C:/music/foo.mp3 + + + Linux Path + file:///media/music/foo.mp3 + + + Relative Path + music/foo.mp3 + + + External Example + http://www.example.com/music/bar.ogg + + + +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;