]> iEval git - app-musicexpo.git/commitdiff
More tests
authorMarius Gavrilescu <Marius Gavrilescu>
Sun, 18 Aug 2013 07:39:52 +0000 (10:39 +0300)
committerMarius Gavrilescu <Marius Gavrilescu>
Sun, 18 Aug 2013 07:39:52 +0000 (10:39 +0300)
t/App-MusicExpo.t
t/musicexpo-cache.t [new file with mode: 0644]
t/musicexpo.t [new file with mode: 0644]

index 6dfc4550421fab69cad8f769fa8e28f13b1707d0..0ad611b96208b034564e138208e951722c1a5ff3 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -wT -CSDA
 use v5.14;
 use warnings;
 
diff --git a/t/musicexpo-cache.t b/t/musicexpo-cache.t
new file mode 100644 (file)
index 0000000..635f671
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -wT -CSDA
+use v5.14;
+use warnings;
+
+use Test::More tests => 3;
+
+use File::Temp qw/tempfile/;
+use DB_File;
+use Storable qw/thaw/;
+
+my $file;
+
+BEGIN {
+  $file = (tempfile UNLINK => 1)[1];
+  @ARGV = (-cache => $file, 'empty.flac', 'empty.mp3');
+}
+BEGIN { use_ok('App::MusicExpo'); }
+
+close STDOUT;
+my $out;
+open STDOUT, '>', \$out;
+
+App::MusicExpo->run;
+
+is $out, <<'OUT', 'output is correct';
+<!DOCTYPE html>
+<title>Music</title>
+<meta charset="utf-8">
+<link rel="stylesheet" href="/music.css">
+
+<table border>
+<thead>
+<tr><th>Title<th>Artist<th>Album<th>Genre<th>Track<th>Year<th>Type
+<tbody>
+<tr><td><a href="%2Fmusic%2Fempty.flac">Cellule</a><td>Silence<td>L&#39;autre endroit<td>Electro<td>01/09<td>2005<td>FLAC
+<tr><td><a href="%2Fmusic%2Fempty.mp3">Cellule</a><td>Silence<td>L&#39;autre endroit<td>Electro<td>01/09<td>2005<td>MP3
+</table>
+OUT
+
+ok -e $file, 'cache exists';
+tie my %db, DB_File => $file;
diff --git a/t/musicexpo.t b/t/musicexpo.t
new file mode 100644 (file)
index 0000000..b2f133c
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -wT -CSDA
+use v5.14;
+use warnings;
+
+use Test::More tests => 2;
+
+use Storable qw/thaw/;
+
+BEGIN { use_ok('App::MusicExpo'); }
+
+close STDOUT;
+my $out;
+open STDOUT, '>', \$out;
+
+App::MusicExpo->run;
+
+is $out, <<'OUT', 'output is correct';
+<!DOCTYPE html>
+<title>Music</title>
+<meta charset="utf-8">
+<link rel="stylesheet" href="/music.css">
+
+<table border>
+<thead>
+<tr><th>Title<th>Artist<th>Album<th>Genre<th>Track<th>Year<th>Type
+<tbody>
+</table>
+OUT
This page took 0.019964 seconds and 4 git commands to generate.