]> iEval git - app-musicexpo.git/blame - t/App-MusicExpo.t
Bump version and update Changes
[app-musicexpo.git] / t / App-MusicExpo.t
CommitLineData
8086953c 1#!/usr/bin/perl -wT
21cd9240
MG
2use v5.14;
3use warnings;
4
f7964165 5use Test::More tests => 46;
21cd9240 6
b484a129 7use Scalar::Util qw/looks_like_number/;
21cd9240
MG
8use Storable qw/thaw/;
9
10BEGIN { use_ok('App::MusicExpo'); }
11
b484a129
MG
12my %data = (
13 title => 'Cellule',
14 artist => 'Silence',
15 year => 2005,
16 album => 'L\'autre endroit',
17 tracknumber => 1,
18 tracktotal => 9,
19 genre => 'Electro'
20);
21
f7964165
MG
22my %handled = map { $_ => 1 } App::MusicExpo::extensions_handled;
23
b484a129
MG
24sub test {
25 my ($format, $sub, $file) = @_;
f7964165
MG
26 my ($ext) = $file =~ /(\..+)$/;
27
28 SKIP:
29 {
30 skip "Cannot handle $ext files (tag-reading module missing)", 9 unless $handled{$ext};
31 my $info = thaw $sub->($file);
32 is $info->{format}, $format, "$format format";
33 for (sort keys %data) {
34 my $op = looks_like_number $data{$_} ? '==' : 'eq';
35 cmp_ok $info->{$_}, $op, $data{$_}, "$format $_"
36 }
37 is $info->{file}, $file, "$format file";
b484a129 38 }
b484a129
MG
39}
40
41test FLAC => \&App::MusicExpo::flacinfo, 'empty.flac';
42test MP3 => \&App::MusicExpo::mp3info, 'empty3.mp3';
43test Vorbis => \&App::MusicExpo::vorbisinfo, 'empty.ogg';
44test AAC => \&App::MusicExpo::mp4info, 'empty4.aac';
f7964165 45test Opus => \&App::MusicExpo::opusinfo, 'empty2.opus';
This page took 0.027618 seconds and 4 git commands to generate.