From 0999c453706a3e6730630eca53762c888a9d999e Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 2 Apr 2001 10:07:53 +0000 Subject: [PATCH] added test to check for crash in set_internal() (and it's normal return value) --- t/t15color.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/t15color.t b/t/t15color.t index 9dcccdee..4f1e4007 100644 --- a/t/t15color.t +++ b/t/t15color.t @@ -6,7 +6,7 @@ # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) -BEGIN { $| = 1; print "1..4\n"; } +BEGIN { $| = 1; print "1..5\n"; } END {print "not ok 1\n" unless $loaded;} use Imager; $loaded = 1; @@ -20,6 +20,18 @@ my $c2 = Imager::Color->new(100, 150, 200); print test_col($c2, 100, 150, 200, 255) ? "ok 3\n" : "not ok 3\n"; my $c3 = Imager::Color->new("#6496C8"); print test_col($c3, 100, 150, 200, 255) ? "ok 4\n" : "not ok 4\n"; +# crashes in Imager-0.38pre8 and earlier +my @foo; +for (1..1000) { + push(@foo, Imager::Color->new("#FFFFFF")); +} +my $fail; +for (@foo) { + Imager::Color::set_internal($_, 128, 128, 128, 128) == $_ or ++$fail; + Imager::Color::set_internal($_, 128, 128, 128, 128) == $_ or ++$fail; +} +$fail and print "not "; +print "ok 5\n"; sub test_col { my ($c, $r, $g, $b, $a) = @_; -- 2.39.5