summaryrefslogtreecommitdiff
path: root/t/29-app-dthumb-data.t
blob: 7ca9f2db690cfaacf8743105c372faa0b6210d15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use autodie;

use App::Dthumb::Data;
use Test::More;

opendir(my $share, 'share');
my @files = grep { /^[^.]/ } readdir($share);
closedir($share);

plan(
	tests => 2 + scalar @files,
);

my $dthumb = App::Dthumb::Data->new();

isa_ok($dthumb, 'App::Dthumb::Data', 'App::Dthumb::Data->new()');

for my $file (@files) {
	open(my $fh, '<', "share/${file}");
	my $data = do { local $/ = undef; <$fh> };
	close($fh);

	is($dthumb->get($file), $data, "\$dthumb->get($file)");
}

is($dthumb->get('404notfound'), undef, '$dthumb->get on non-existing file');