diff options
Diffstat (limited to 't/tests/model')
-rw-r--r-- | t/tests/model/music-file.t | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/t/tests/model/music-file.t b/t/tests/model/music-file.t index 2016f8e..845a88d 100644 --- a/t/tests/model/music-file.t +++ b/t/tests/model/music-file.t @@ -5,28 +5,17 @@ use Ultramarine::Model::MusicFile; # test file generated with: # avconv -ac 2 -ar 44100 -f s16le -i /dev/zero -t 1 -q 0 -metadata title="some title" -metadata artist="some artist" test.mp3 -my Ultramarine::Model::MusicFile $mf .= new(:path('t/data/test.mp3')); -my $data = $mf.metadata; +# this way we test that MusicFile passes a usable path to avprobe, not +# just the .Str +my $path = IO::Path.new('test.mp3',:CWD('t/data/')); +my Ultramarine::Model::MusicFile $mf .= new(:$path); +my %data = $mf.metadata; -is-deeply( - $data, - %( - :bit_rate("33633.000000"), - :duration("1.044898"), - :filename("t/data/test.mp3"), - :format_long_name("MP2/3 (MPEG audio layer 2/3)"), - :format_name("mp3"), - :nb_streams(1), - :size("4393.000000"), - :start_time("0.000000"), - :tags(%( - :artist("some artist"), - :encoder("Lavf56.1.0"), - :title("some title"), - )), - ), - 'metadata should match', -); +is-approx(%data<bit_rate>.Num,33633,:1abs-tol,'bit rate should match'); +is-approx(%data<duration>.Num,1,:1abs-tol,'length should match'); +is(%data<format_name>,'mp3','format should match'); +is(%data<tags><artist>,'some artist','artist should match'); +is(%data<tags><title>,'some title','title should match'); done-testing; |