File: 200-nosuch.t

package info (click to toggle)
libimager-perl 1.027%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,820 kB
  • sloc: perl: 32,971; ansic: 28,092; makefile: 52; cpp: 4
file content (34 lines) | stat: -rw-r--r-- 920 bytes parent folder | download
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
31
32
33
34
#!perl -w
use strict;
use Imager;
use Test::More;

# test handling of unknown file formats

my $log_file = "testout/file-200-nosuch.log";

Imager->open_log(log => $log_file);

my $im = Imager->new;
ok(!$im->read(file => "testimg/base.jpg", type=> "unknown"),
   "check we can't read 'unknown' format files");
like($im->errstr, qr/format 'unknown' not supported/,
     "check no unknown message");
$im = Imager->new(xsize => 2, ysize => 2);
ok(!$im->write(file => "testout/nosuch.unknown", type => "unknown"),
   "check we can't write 'unknown' format files");
like($im->errstr, qr/format 'unknown' not supported/,
     "check no 'unknown' message");

ok(!grep($_ eq "unknown", Imager->read_types),
   "check unknown not in read types");
ok(!grep($_ eq "unknown", Imager->write_types),
   "check unknown not in write types");

done_testing();

Imager->close_log;

unless ($ENV{IMAGER_KEEP_FILES}) {
  unlink $log_file;
}