8 use Test::Builder::Tester tests => 6;
9 Test::Builder::Tester::color 'on';
20 my $tcarped = File::Spec->catfile('t','carped.t');
21 $tcarped =~ s/\\/\//g if $^O eq 'MSWin32';
24 warnings_like {foo()} [map {qr/$_/} (1 .. 4)];
25 test_test "Warnings and Carpings mixed, asked only for like warnings";
30 "found warning: Warning 1 at $tcarped line 13.",
31 "found carped warning: Carping 2 at $tcarped line 14",
32 "found carped warning: Carping 3 at $tcarped line 15",
33 "found warning: Warning 4 at $tcarped line 16.",
34 "expected to find carped warning: (?-xism:1)",
35 "expected to find carped warning: (?-xism:2)",
36 "expected to find carped warning: (?-xism:3)",
37 "expected to find carped warning: (?-xism:4)";
38 warnings_like {foo()} [{carped => [map {qr/$_/} (1 .. 4)]}];
39 test_test "Warnings and Carpings mixed, asked only for like carpings";
42 warnings_like {foo()} [qr/1/, {carped => [qr/2/, qr/3/]}, qr/4/];
43 test_test "Warnings and Carpings mixed, asked for the right likes";
45 my @msg = ("Warning 1", "Carping 2", "Carping 3", "Warning 4");
47 warnings_are {foo()} \@msg;
48 test_test "Warnings and Carpings mixed, asked only for warnings";
53 "found warning: Warning 1 at $tcarped line 13.",
54 "found carped warning: Carping 2 at $tcarped line 14",
55 "found carped warning: Carping 3 at $tcarped line 15",
56 "found warning: Warning 4 at $tcarped line 16.",
57 "expected to find carped warning: Warning 1",
58 "expected to find carped warning: Carping 2",
59 "expected to find carped warning: Carping 3",
60 "expected to find carped warning: Warning 4";
61 warnings_are {foo()} {carped => \@msg};
62 test_test "Warnings and Carpings mixed, asked only for carpings";
65 warnings_are {foo()} [$msg[0], {carped => [@msg[1..2]]}, $msg[3]];
66 test_test "Warnings and Carpings mixed, asked for the right ones";