Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / t / cdbi / set_to_undef.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2 use DBIx::Class::Optional::Dependencies -skip_all_without => qw( ic_dt cdbicompat );
3
4 use strict;
5 use warnings;
6
7 use Test::More;
8 use lib 't/cdbi/testlib';
9
10 # Don't use Test::NoWarnings because of an unrelated DBD::SQLite warning.
11 my @warnings;
12 local $SIG{__WARN__} = sub {
13     push @warnings, @_;
14 };
15
16 {
17     package Thing;
18
19     use base 'DBIC::Test::SQLite';
20
21     Thing->columns(All  => qw[thing_id this that date]);
22 }
23
24 my $thing = Thing->construct({ thing_id => 23, this => 42 });
25 $thing->set( this => undef );
26 is $thing->get( "this" ), undef, 'undef set';
27 $thing->discard_changes;
28
29 is @warnings, 0, 'no warnings';
30
31 done_testing;