Commit | Line | Data |
d0289ee1 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | use Test::Exception; |
8 | |
9 | use DBICTest; |
10 | |
11 | my $schema = DBICTest->init_schema(); |
12 | |
13 | # this has been warning for 4 years, killing |
14 | throws_ok { |
15 | $schema->resultset('Artist')->find(artistid => 4); |
16 | } qr|expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint|; |
17 | |
18 | { |
19 | my $exception_callback_count = 0; |
20 | |
21 | my $ea = $schema->exception_action(sub { |
22 | $exception_callback_count++; |
23 | die @_; |
24 | }); |
25 | |
26 | # No, this is not a great idea. |
27 | # Yes, people do it anyway. |
28 | # Might as well test that we have fixed it for good, by never invoking |
29 | # a potential __DIE__ handler in internal_try() stacks |
30 | local $SIG{__DIE__} = sub { $ea->(@_) }; |
31 | |
32 | # test find on non-unique non-existing value |
33 | is ( |
34 | $schema->resultset('Artist')->find({ rank => 666 }), |
35 | undef |
36 | ); |
37 | |
38 | # test find on an unresolvable condition |
39 | is( |
40 | $schema->resultset('Artist')->find({ artistid => [ -and => 1, 2 ]}), |
41 | undef |
42 | ); |
43 | |
44 | is $exception_callback_count, 0, 'exception_callback never invoked'; |
45 | } |
46 | |
47 | done_testing; |