Codebase list libexception-class-dbi-perl / b6c2ab4
Changed some tests to use use_ok(). Added $Id tags to all tests. David Wheeler 21 years ago
4 changed file(s) with 22 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
0 #!/usr/bin/perl -w
1
2 # $Id: Makefile.PL,v 1.3 2002/08/22 16:10:24 david Exp $
3
4 use strict;
05 use ExtUtils::MakeMaker;
16 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
27 # the contents of the Makefile that is written.
00 #!/usr/bin/perl -w
1
2 # $Id: dbh.t,v 1.3 2002/08/22 16:10:24 david Exp $
13
24 use strict;
35 use Test::More (tests => 27);
1416 END { $dbh->disconnect if $dbh };
1517
1618 # Check that the error_handler has been installed.
17 ok( UNIVERSAL::isa($dbh->{HandleError}, 'CODE'), "Check HandlError" );
19 isa_ok( $dbh->{HandleError}, 'CODE' );
1820
1921 # Trigger an exception.
2022 eval {
2325
2426 # Make sure we got the proper exception.
2527 ok( my $err = $@, "Get exception" );
26 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI'), "Check E::C::DBI" );
27 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI::H'),
28 "Check E::C::DBI::H" );
29 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI::DBH'),
30 "Check E::C::DBI::DBH" );
28 isa_ok( $err, 'Exception::Class::DBI' );
29 isa_ok( $err, 'Exception::Class::DBI::H' );
30 isa_ok( $err, 'Exception::Class::DBI::DBH' );
3131
3232 # Check the accessor values.
3333 ok( $err->err == 1, "Check err" );
00 #!/usr/bin/perl -w
1
2 # $Id: drh.t,v 1.4 2002/08/22 16:10:24 david Exp $
13
24 use strict;
35 use Test::More (tests => 21);
2527 skip 'HandleError not logic not yet used by DBI->connect', 20
2628 unless $@;
2729 ok( my $err = $@, "Caught exception" );
28 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI'), "Check E::C::DBI" );
29 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI::H'),
30 "Check E::C::DBI::H" );
31 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI::DRH'),
32 "Check E::C::DBI::DRH" );
30 isa_ok( $err, 'Exception::Class::DBI' );
31 isa_ok( $err, 'Exception::Class::DBI::H' );
32 isa_ok( $err, 'Exception::Class::DBI::DRH' );
3333 ok( $err->err == 7, "Check err" );
3434 is( $err->error,
3535 'DBI->connect(dummy) failed: Dammit Jim!', 'Check error' );
00 #!/usr/bin/perl -w
1
2 # $Id: sth.t,v 1.3 2002/08/22 16:10:24 david Exp $
13
24 use strict;
35 use Test::More (tests => 35);
1618 END { $dbh->disconnect if $dbh };
1719
1820 # Check that the error_handler has been installed.
19 ok( UNIVERSAL::isa($dbh->{HandleError}, 'CODE'), "Check HandlError" );
21 isa_ok( $dbh->{HandleError}, 'CODE' );
2022
2123 # Trigger an exception.
2224 eval {
2830
2931 # Make sure we got the proper exception.
3032 ok( my $err = $@, "Get exception" );
31 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI'), "Check E::C::DBI" );
32 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI::H'),
33 "Check E::C::DBI::H" );
34 ok( UNIVERSAL::isa($err, 'Exception::Class::DBI::STH'),
35 "Check E::C::DBI::STH" );
33 isa_ok( $err, 'Exception::Class::DBI' );
34 isa_ok( $err, 'Exception::Class::DBI::H' );
35 isa_ok( $err, 'Exception::Class::DBI::STH' );
3636
3737 ok( $err->err == 7, "Check err" );
3838 is( $err->errstr, 'ERROR: Relation "foo" does not exist',