[Bast-commits] r4661 - in trunk/DBIx-Class-EncodedColumn: . lib/DBIx/Class t

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Mon Jul 28 23:39:42 BST 2008


Author: groditi
Date: 2008-07-28 23:39:41 +0100 (Mon, 28 Jul 2008)
New Revision: 4661

Modified:
   trunk/DBIx-Class-EncodedColumn/Changes
   trunk/DBIx-Class-EncodedColumn/Makefile.PL
   trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm
   trunk/DBIx-Class-EncodedColumn/t/02digest.t
Log:
fix the tests, use subname

Modified: trunk/DBIx-Class-EncodedColumn/Changes
===================================================================
--- trunk/DBIx-Class-EncodedColumn/Changes	2008-07-28 22:12:36 UTC (rev 4660)
+++ trunk/DBIx-Class-EncodedColumn/Changes	2008-07-28 22:39:41 UTC (rev 4661)
@@ -1,4 +1,4 @@
-0.0002        2008-07-27
+0.00002        2008-07-27
         - Support for Crypt::OpenPGP
 
 0.00001        2008-02-01

Modified: trunk/DBIx-Class-EncodedColumn/Makefile.PL
===================================================================
--- trunk/DBIx-Class-EncodedColumn/Makefile.PL	2008-07-28 22:12:36 UTC (rev 4660)
+++ trunk/DBIx-Class-EncodedColumn/Makefile.PL	2008-07-28 22:39:41 UTC (rev 4661)
@@ -10,6 +10,7 @@
 
 # Specific dependencies
 requires 'DBIx::Class' => '0.06002';
+requires 'Sub::Name' => '0.04';
 
 #build dependencies
 build_requires 'Test::More';
@@ -38,5 +39,4 @@
     'Crypt::OpenPGP',
     'Crypt::CAST5_PP';
 
-auto_install;
 WriteAll;

Modified: trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm
===================================================================
--- trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm	2008-07-28 22:12:36 UTC (rev 4660)
+++ trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm	2008-07-28 22:39:41 UTC (rev 4661)
@@ -5,10 +5,11 @@
 
 use base qw/DBIx::Class/;
 use Digest;
+use Sub::Name;
 
 __PACKAGE__->mk_classdata( _column_encoders => {} );
 
-our $VERSION = '0.00001';
+our $VERSION = '0.00002';
 
 sub register_column {
   my $self = shift;
@@ -36,7 +37,8 @@
     no strict 'refs';
     defined( my $check_sub = eval{ $class->make_check_sub($column, $args) }) ||
       $self->throw_exception("Failed to create checker with class '$class': $@");
-    *{$self->result_class.'::'.$info->{encode_check_method}} = $check_sub;
+    my $name = join '::', $self->result_class, $info->{encode_check_method};
+    *$name = subname $name, $check_sub;
   }
 }
 

Modified: trunk/DBIx-Class-EncodedColumn/t/02digest.t
===================================================================
--- trunk/DBIx-Class-EncodedColumn/t/02digest.t	2008-07-28 22:12:36 UTC (rev 4660)
+++ trunk/DBIx-Class-EncodedColumn/t/02digest.t	2008-07-28 22:39:41 UTC (rev 4661)
@@ -13,7 +13,7 @@
 BEGIN {
   $sha_ok    = eval 'require Digest' && eval 'require Digest::SHA;';
   $bcrypt_ok = eval 'require Crypt::Eksblowfish::Bcrypt';
-  $pgp_ok    = eval 'require Crypt::Eksblowfish::Bcrypt';
+  $pgp_ok    = eval 'require Crypt::OpenPGP';
 }
 
 my $tests = 5;
@@ -23,6 +23,7 @@
 
 plan tests => $tests;
 
+#1
 use_ok("DigestTest");
 
 my $schema = DigestTest->init_schema;
@@ -57,9 +58,11 @@
 
 my $row = $rs->create( \%create_vals );
 
-is($row->dummy_col,  'test1',                            'dummy on create');
+#2
+is($row->dummy_col,  'test1','dummy on create');
 ok(!$row->can('check_dummy_col'));
 
+#8
 if( $bcrypt_ok ){
   is( length($row->bcrypt_1), 60, 'correct length');
   is( length($row->bcrypt_2), 59, 'correct length');
@@ -74,6 +77,7 @@
   ok( $row->bcrypt_2_check('test2'));
 }
 
+#14
 if( $sha_ok ) {
   is($row->sha1_hex,   $checks->{'SHA-1'}{hex}{test1},     'hex sha1 on create');
   is($row->sha1_b64,   $checks->{'SHA-1'}{base64}{test1},  'b64 sha1 on create');
@@ -113,12 +117,13 @@
   $row->update;
 
 } else {
-
+  #1
   $row->update({dummy_col => 'test2'});
   is($row->dummy_col,  'test2', 'dummy on update');
 
 }
 
+#4
 if( $sha_ok ) {
   my $copy = $row->copy({sha256_b64 => 'test2'});
   is($copy->sha1_hex,   $checks->{'SHA-1'}{hex}{test2},     'hex sha1 on copy');
@@ -127,9 +132,11 @@
   is($copy->sha256b64,  $checks->{'SHA-256'}{base64}{test2},'b64 sha256 on copy');
 }
 
+#1
 my $new = $rs->new( \%create_vals );
 is($new->dummy_col,  'test1', 'dummy on new');
 
+#4
 if( $sha_ok ){
   is($new->sha1_hex,   $checks->{'SHA-1'}{hex}{test1},      'hex sha1 on new');
   is($new->sha1_b64,   $checks->{'SHA-1'}{base64}{test1},   'b64 sha1 on new');
@@ -137,8 +144,9 @@
   is($new->sha256b64,  $checks->{'SHA-256'}{base64}{test1}, 'b64 sha256 on new');
 }
 
+#6
 if ( $pgp_ok ) {
-    my $row = $rs->create( { 
+    my $row = $rs->create( {
         dummy_col          => 'Dummy Column',
         pgp_col_passphrase => 'Test Encrypted Column with Passphrase',
         pgp_col_key        => 'Test Encrypted Column with Key Exchange',
@@ -150,8 +158,8 @@
     like($row->pgp_col_key_ps, qr/BEGIN PGP MESSAGE/, 'Key+Passphrase encrypted');
 
     is(
-        $row->decrypt_pgp_passphrase('Secret Words'), 
-        'Test Encrypted Column with Passphrase', 
+        $row->decrypt_pgp_passphrase('Secret Words'),
+        'Test Encrypted Column with Passphrase',
         'Passphrase decryption/encryption'
     );
 
@@ -162,7 +170,7 @@
     );
 
     is(
-        $row->decrypt_pgp_key_ps('Secret Words'), 
+        $row->decrypt_pgp_key_ps('Secret Words'),
         'Test Encrypted Column with Key Exchange + Pass',
         'Secured Key Exchange decryption/encryption'
     );




More information about the Bast-commits mailing list