]> iEval git - app-musicexpo.git/blame - t/musicexpo-cache.t
Bump version and update Changes
[app-musicexpo.git] / t / musicexpo-cache.t
CommitLineData
8c158a92 1#!/usr/bin/perl -w
23867054
MG
2use v5.14;
3use warnings;
4
5use Test::More tests => 3;
6
7use File::Temp qw/tempfile/;
23867054
MG
8
9my $file;
10
11BEGIN {
12 $file = (tempfile UNLINK => 1)[1];
a535e879 13 @ARGV = (-cache => $file, sort <empty*>);
23867054
MG
14}
15BEGIN { use_ok('App::MusicExpo'); }
16
17close STDOUT;
18my $out;
19open STDOUT, '>', \$out;
20
f7964165
MG
21my %handled = map { $_ => 1 } App::MusicExpo::extensions_handled;
22
23my $prefix = '<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">';
24
25my @lines;
26if ($handled{'.flac'} && $handled{'.ogg'}) {
27 push @lines, $prefix . '<a href="/music/empty.flac">FLAC</a> <a href="/music/empty.ogg">Vorbis</a> '
28} elsif ($handled{'.flac'}) {
29 push @lines, $prefix . '<a href="/music/empty.flac">FLAC</a> '
30} elsif ($handled{'.ogg'}) {
31 push @lines, $prefix . '<a href="/music/empty.ogg">Vorbis</a> '
32}
33
34push @lines, $prefix . '<a href="/music/empty2.opus">Opus</a> ' if $handled{'.opus'};
35push @lines, $prefix . '<a href="/music/empty3.mp3">MP3</a> ' if $handled{'.mp3'};
4a88f331 36push @lines, '<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> ' if $handled{'.aac'};
f7964165 37
4ffde4cd 38my $contents = join '', map { "\n$_" } @lines;
f7964165 39
23867054
MG
40App::MusicExpo->run;
41
f7964165 42is $out, <<"OUT", 'output is correct';
23867054
MG
43<!DOCTYPE html>
44<title>Music</title>
45<meta charset="utf-8">
6b125df7 46<link rel="stylesheet" href="musicexpo.css">
1fc49a0c
MG
47<script async defer type="application/javascript" src="player.js"></script>
48
49<div id="player"></div>
23867054
MG
50
51<table border>
52<thead>
53<tr><th>Title<th>Artist<th>Album<th>Genre<th>Track<th>Year<th>Type
f7964165 54<tbody>$contents
23867054
MG
55</table>
56OUT
57
58ok -e $file, 'cache exists';
This page took 0.0385720000000001 seconds and 4 git commands to generate.