Improve tests
[app-musicexpo.git] / t / musicexpo-cache.t
1 #!/usr/bin/perl -wT
2 use v5.14;
3 use warnings;
4
5 use Test::More tests => 3;
6
7 use File::Temp qw/tempfile/;
8
9 my $file;
10
11 BEGIN {
12 $file = (tempfile UNLINK => 1)[1];
13 @ARGV = (-cache => $file, sort <empty*>);
14 }
15 BEGIN { use_ok('App::MusicExpo'); }
16
17 close STDOUT;
18 my $out;
19 open STDOUT, '>', \$out;
20
21 App::MusicExpo->run;
22
23 is $out, <<'OUT', 'output is correct';
24 <!DOCTYPE html>
25 <title>Music</title>
26 <meta charset="utf-8">
27 <link rel="stylesheet" href="musicexpo.css">
28 <script async defer type="application/javascript" src="player.js"></script>
29
30 <div id="player"></div>
31
32 <table border>
33 <thead>
34 <tr><th>Title<th>Artist<th>Album<th>Genre<th>Track<th>Year<th>Type
35 <tbody>
36 <tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">01/09<td class="year">2005<td class="formats"><a href="/music/empty.flac">FLAC</a> <a href="/music/empty.ogg">Vorbis</a>
37 <tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">01/09<td class="year">2005<td class="formats"><a href="/music/empty3.mp3">MP3</a>
38 <tr><td class="title"><a href="#silence-cellule" data-hash="#silence-cellule">Cellule</a><td class="artist">Silence<td class="album">L&#39;autre endroit<td class="genre">Electro<td class="track">1/9<td class="year">2005<td class="formats"><a href="/music/empty4.aac">AAC</a>
39 </table>
40 OUT
41
42 ok -e $file, 'cache exists';
This page took 0.026027 seconds and 4 git commands to generate.