]>
Commit | Line | Data |
---|---|---|
8086953c | 1 | #!/usr/bin/perl -wT |
23867054 MG |
2 | use v5.14; |
3 | use warnings; | |
4 | ||
5 | use Test::More tests => 3; | |
6 | ||
7 | use File::Temp qw/tempfile/; | |
8 | use DB_File; | |
9 | use Storable qw/thaw/; | |
10 | ||
11 | my $file; | |
12 | ||
13 | BEGIN { | |
14 | $file = (tempfile UNLINK => 1)[1]; | |
15 | @ARGV = (-cache => $file, 'empty.flac', 'empty.mp3'); | |
16 | } | |
17 | BEGIN { use_ok('App::MusicExpo'); } | |
18 | ||
19 | close STDOUT; | |
20 | my $out; | |
21 | open STDOUT, '>', \$out; | |
22 | ||
23 | App::MusicExpo->run; | |
24 | ||
25 | is $out, <<'OUT', 'output is correct'; | |
26 | <!DOCTYPE html> | |
27 | <title>Music</title> | |
28 | <meta charset="utf-8"> | |
29 | <link rel="stylesheet" href="/music.css"> | |
1fc49a0c MG |
30 | <script async defer type="application/javascript" src="player.js"></script> |
31 | ||
32 | <div id="player"></div> | |
23867054 MG |
33 | |
34 | <table border> | |
35 | <thead> | |
36 | <tr><th>Title<th>Artist<th>Album<th>Genre<th>Track<th>Year<th>Type | |
37 | <tbody> | |
95267d4f | 38 | <tr><td>Cellule<td>Silence<td>L'autre endroit<td>Electro<td>01/09<td>2005<td><a href="/music/empty.flac">FLAC</a> <a href="/music/empty.mp3">MP3</a> |
23867054 | 39 | </table> |
95267d4f | 40 | |
9d6d04a4 | 41 | <pre id="json" style="display: none">{"files":[{"album":"L'autre endroit","artist":"Silence","formats":[{"file":"empty.flac","format":"FLAC"},{"file":"empty.mp3","format":"MP3"}],"genre":"Electro","title":"Cellule","tracknumber":"01","tracktotal":"09","year":"2005"}],"prefix":"/music/"}</pre> |
23867054 MG |
42 | OUT |
43 | ||
44 | ok -e $file, 'cache exists'; | |
45 | tie my %db, DB_File => $file; |