From: Peter Rabbitson Date: Tue, 1 Jun 2010 15:45:57 +0000 (+0000) Subject: Rewrite test (no functional changes) X-Git-Tag: v0.08122~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=492bb85a977b5b708fd87af25ebd41a459a9087b;p=dbsrgits%2FDBIx-Class.git Rewrite test (no functional changes) --- diff --git a/t/storage/dbh_do.t b/t/storage/dbh_do.t index 23fd859..a5a58d6 100644 --- a/t/storage/dbh_do.t +++ b/t/storage/dbh_do.t @@ -1,9 +1,9 @@ #!/usr/bin/perl use strict; -use warnings; +use warnings; -use Test::More tests => 8; +use Test::More; use lib qw(t/lib); use DBICTest; @@ -11,23 +11,26 @@ use DBICTest; my $schema = DBICTest->init_schema(); my $storage = $schema->storage; -my $test_func = sub { - is $_[0], $storage; - is $_[1], $storage->dbh; - is $_[2], "foo"; - is $_[3], "bar"; -}; +my @args; +my $test_func = sub { @args = @_ }; -$storage->dbh_do( - $test_func, - "foo", "bar" +$storage->dbh_do($test_func, "foo", "bar"); +is_deeply ( + \@args, + [ $storage, $storage->dbh, "foo", "bar" ], ); + my $storage_class = ref $storage; { - no strict 'refs'; - *{$storage_class .'::__test_method'} = $test_func; + no strict 'refs'; + local *{$storage_class .'::__test_method'} = $test_func; + $storage->dbh_do("__test_method", "baz", "buz"); } -$storage->dbh_do("__test_method", "foo", "bar"); - \ No newline at end of file +is_deeply ( + \@args, + [ $storage, $storage->dbh, "baz", "buz" ], +); + +done_testing;