Codebase list libexception-class-dbi-perl / 66da874
Updated tests to use is() where appropriate. David Wheeler 17 years ago
6 changed file(s) with 44 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
22 0.95
33 - Fixed test failure for localized error messages. Reported by Jens
44 Maier with a fix from Daniel Brook.
5 - Updated tests to use is($foo, $bar) instead of ok( $foo == $bar)
6 Spotted by Andy Lester.
57
68 0.94 2006-06-30T00:04:32
79 - The handler() method now always returns the same code referernce
00 ---
11 name: Exception-Class-DBI
2 version: 0.94
2 version: !!perl/hash:Module::Build::Version
3 original: 0.95
4 version:
5 - 0
6 - 950
37 author:
48 - 'David Wheeler <david@kineticode.com>'
59 abstract: DBI Exception objects
1519 provides:
1620 Exception::Class::DBI:
1721 file: lib/Exception/Class/DBI.pm
18 version: 0.94
22 version: 0.95
1923 Exception::Class::DBI::DBH:
2024 file: lib/Exception/Class/DBI.pm
2125 Exception::Class::DBI::H:
2226 file: lib/Exception/Class/DBI.pm
2327 Exception::Class::DBI::STH:
2428 file: lib/Exception/Class/DBI.pm
25 generated_by: Module::Build version 0.2801
29 generated_by: Module::Build version 0.2804
2630 meta-spec:
2731 url: http://module-build.sourceforge.net/META-spec-v1.2.html
2832 version: 1.2
00 #!/usr/bin/perl -w
11
2 # $Id: dbh.t,v 1.5 2002/09/17 03:32:47 david Exp $
2 # $Id$
33
44 use strict;
5 use Test::More (tests => 27);
6 BEGIN { use_ok('Exception::Class::DBI') }
5 use Test::More tests => 28;
6 BEGIN { use_ok('Exception::Class::DBI') or die }
77 use DBI;
88
9 ok( my $dbh = DBI->connect('dbi:ExampleP:dummy', '', '',
9 ok( my $dbh = DBI->connect(
10 'dbi:ExampleP:dummy', '', '',
1011 { PrintError => 0,
1112 RaiseError => 0,
1213 HandleError => Exception::Class::DBI->handler
3031 isa_ok( $err, 'Exception::Class::DBI::DBH' );
3132
3233 # Check the accessor values.
33 ok( $err->err == 1, "Check err" );
34 is( $err->err, 1, "Check err" );
3435 is( $err->errstr, 'Unknown field names: foo', "Check errstr" );
3536 is( $err->error, 'DBD::ExampleP::db do failed: Unknown field names: foo',
3637 "Check error" );
3738 is( $err->state, 'S1000', "Check state" );
3839 ok( ! defined $err->retval, "Check retval" );
39 ok( $err->warn == 1, "Check warn" );
40 ok( $err->active == 1, "Check active" );
40 is( $err->warn, 1, "Check warn" );
41 is( $err->active, 1, "Check active" );
4142 # For some reason, under perl < 5.8.0, $dbh->{Kids} returns a different value
4243 # inside the HandleError scope than it does outside that scope. So we're
4344 # checking for the perl version here to cover our butts on this test. This may
4445 # be fixed in the DBI soon. I'm using the old form of the Perl version number
4546 # as it seems safer with older Perls.
46 #ok( $err->kids == ($^V lt v5.8 ? 1 : 0), "Check kids" );
47 ok( $err->kids == ($] < 5.008 ? 1 : 0), "Check kids" );
48 ok( $err->active_kids == 0, "Check active_kids" );
47 is( $err->kids, ($^V lt v5.8 ? 1 : 0), "Check kids" );
48 is( $err->kids, ($] < 5.008 ? 1 : 0), "Check kids" );
49 is( $err->active_kids, 0, "Check active_kids" );
4950 ok( ! $err->inactive_destroy, "Check inactive_destroy" );
50 ok( $err->trace_level == 0, "Check trace_level" );
51 is( $err->trace_level, 0, "Check trace_level" );
5152 is( $err->fetch_hash_key_name, 'NAME', "Check fetch_hash_key_name" );
5253 ok( ! $err->chop_blanks, "Check chop_blanks" );
53 ok( $err->long_read_len == 80, "Check long_read_len" );
54 is( $err->long_read_len, 80, "Check long_read_len" );
5455 ok( ! $err->long_trunc_ok, "Check long_trunc_ok" );
5556 ok( ! $err->taint, "Check taint" );
5657 ok( $err->auto_commit, "Check auto_commit" );
00 #!/usr/bin/perl -w
11
2 # $Id: dbi.t,v 1.4 2002/12/12 20:15:48 david Exp $
2 # $Id$
33
44 use strict;
5 use Test::More (tests => 14);
6 BEGIN { use_ok('Exception::Class::DBI') }
5 use Test::More tests => 14;
6 BEGIN { use_ok('Exception::Class::DBI') or die }
77 use DBI;
88
99 eval {
00 #!/usr/bin/perl -w
11
2 # $Id: drh.t,v 1.5 2002/12/12 20:15:48 david Exp $
2 # $Id$
33
44 use strict;
5 use Test::More (tests => 21);
5 use Test::More tests => 21;
66 BEGIN { use_ok('Exception::Class::DBI') }
77 use DBI;
88
3030 isa_ok( $err, 'Exception::Class::DBI' );
3131 isa_ok( $err, 'Exception::Class::DBI::H' );
3232 isa_ok( $err, 'Exception::Class::DBI::DRH' );
33 ok( $err->err == 7, "Check err" );
33 is( $err->err, 7, "Check err" );
3434 is( $err->error, "DBI connect('dummy','',...) failed: Dammit Jim!",
3535 'Check error' );
3636 is( $err->errstr, 'Dammit Jim!', 'Check errstr' );
3737 is( $err->state, 'ABCDE', 'Check state' );
3838 ok( ! defined $err->retval, "Check retval" );
39 ok( $err->warn == 1, "Check warn" );
40 ok( $err->active == 1, "Check active" );
41 ok( $err->kids == 0, "Check kids" );
42 ok( $err->active_kids == 0, "Check acitive_kids" );
39 is( $err->warn, 1, "Check warn" );
40 is( $err->active, 1, "Check active" );
41 is( $err->kids, 0, "Check kids" );
42 is( $err->active_kids, 0, "Check acitive_kids" );
4343 ok( ! $err->inactive_destroy, "Check inactive_destroy" );
44 ok( $err->trace_level == 0, "Check trace_level" );
44 is( $err->trace_level, 0, "Check trace_level" );
4545 is( $err->fetch_hash_key_name, 'NAME', "Check fetch_hash_key_name" );
4646 ok( ! $err->chop_blanks, "Check chop_blanks" );
47 ok( $err->long_read_len == 80, "Check long_read_len" );
47 is( $err->long_read_len, 80, "Check long_read_len" );
4848 ok( ! $err->long_trunc_ok, "Check long_trunc_ok" );
4949 ok( ! $err->taint, "Check taint" );
5050 }
22 # $Id$
33
44 use strict;
5 use Test::More (tests => 35);
6 BEGIN { use_ok('Exception::Class::DBI') }
5 use Test::More tests => 35;
6 BEGIN { use_ok('Exception::Class::DBI') or die }
77 # Use PurePerl to get around CursorName bug.
88 BEGIN { $ENV{DBI_PUREPERL} = 2 }
99 use DBI;
3333 isa_ok( $err, 'Exception::Class::DBI::H' );
3434 isa_ok( $err, 'Exception::Class::DBI::STH' );
3535
36 ok( $err->err == 2, "Check err" );
36 is( $err->err, 2, "Check err" );
3737 is( $err->errstr, "opendir(foo): $bang",
3838 "Check errstr" );
3939 like( $err->error,
4242 is( $err->state, 'S1000', "Check state" );
4343 ok( ! defined $err->retval, "Check retval" );
4444
45 ok( $err->warn == 1, 'Check warn' );
45 is( $err->warn, 1, 'Check warn' );
4646 ok( !$err->active, 'Check active' );
47 ok( $err->kids == 0, 'Check kids' );
48 ok( $err->active_kids == 0, 'Check active_kids' );
47 is( $err->kids, 0, 'Check kids' );
48 is( $err->active_kids, 0, 'Check active_kids' );
4949 ok( ! $err->compat_mode, 'Check compat_mode' );
5050 ok( ! $err->inactive_destroy, 'Check inactive_destroy' );
5151
5353 # PurePerl->{TraceLevel} should return an integer, but it doesn't. It
5454 # returns undef instead.
5555 local $^W;
56 ok( $err->trace_level == 0, 'Check trace_level' );
56 cmp_ok( $err->trace_level, '==', 0, 'Check trace_level' );
5757 }
5858
5959 is( $err->fetch_hash_key_name, 'NAME', 'Check fetch_hash_key_name' );
6060 ok( ! $err->chop_blanks, 'Check chop_blanks' );
61 ok( $err->long_read_len == 80, 'Check long_read_len' );
61 is( $err->long_read_len, 80, 'Check long_read_len' );
6262 ok( ! $err->long_trunc_ok, 'Check long_trunc_ok' );
6363 ok( ! $err->taint, 'Check taint' );
64 ok( $err->num_of_fields == 14, 'Check num_of_fields' );
65 ok( $err->num_of_params == 0, 'Check num_of_params' );
64 is( $err->num_of_fields, 14, 'Check num_of_fields' );
65 is( $err->num_of_params, 0, 'Check num_of_params' );
6666 is( ref $err->field_names, 'ARRAY', "Check field_names" );
6767
6868 # These tend to return undef. Probably ought to try to add tests to make