summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-04-03 19:14:01 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-04-03 19:14:01 +0200
commit5ee7824eb667b4d53515ebac442c53c9a94aed41 (patch)
tree4d906692d14d5c755427e886715c3000a35e26c3 /t
parent3f2a49b697a6eb5ff8db78c05c65070b46bb75a6 (diff)
t/20-app-raps2-password.t: Better Test::Exception syntax
Diffstat (limited to 't')
-rw-r--r--t/20-app-raps2-password.t64
1 files changed, 48 insertions, 16 deletions
diff --git a/t/20-app-raps2-password.t b/t/20-app-raps2-password.t
index 6a5f080..67bf29a 100644
--- a/t/20-app-raps2-password.t
+++ b/t/20-app-raps2-password.t
@@ -12,24 +12,51 @@ my $pass = 'something';
use_ok('App::Raps2::Password');
-throws_ok { App::Raps2::Password->new() } qr{incorrect salt length},
- 'new() missing salt and passphrase';
+throws_ok(
+ sub {
+ App::Raps2::Password->new();
+ },
+ qr{incorrect salt length},
+ 'new() missing salt and passphrase'
+);
-throws_ok { App::Raps2::Password->new(salt => $salt) } qr{no passphrase given},
- 'new() missing passphrase';
+throws_ok(
+ sub {
+ App::Raps2::Password->new(salt => $salt);
+ },
+ qr{no passphrase given},
+ 'new() missing passphrase'
+);
-throws_ok { App::Raps2::Password->new(passphrase => $pass) } qr{incorrect salt length},
- 'new() missing salt';
+throws_ok(
+ sub {
+ App::Raps2::Password->new(passphrase => $pass);
+ },
+ qr{incorrect salt length},
+ 'new() missing salt'
+);
-throws_ok { App::Raps2::Password->new(
- passphrase => $pass,
- salt => 'abcdefghijklmno',
- ) } qr{incorrect salt length}, 'new() salt one too short';
+throws_ok(
+ sub {
+ App::Raps2::Password->new(
+ passphrase => $pass,
+ salt => 'abcdefghijklmno',
+ );
+ },
+ qr{incorrect salt length},
+ 'new() salt one too short'
+);
-throws_ok { App::Raps2::Password->new(
- passphrase => $pass,
- salt => $salt . 'z',
- ) } qr{incorrect salt length}, 'new() salt one too long';
+throws_ok(
+ sub {
+ App::Raps2::Password->new(
+ passphrase => $pass,
+ salt => $salt . 'z',
+ );
+ },
+ qr{incorrect salt length},
+ 'new() salt one too long'
+);
$pw = App::Raps2::Password->new(
passphrase => $pass,
@@ -52,7 +79,12 @@ is($pw->decrypt($pw->encrypt('foo')), 'foo', 'encrypt->decrypt okay');
ok($pw->verify('3lJRlaRuOGWv/z3g1DAOlcH.u9vS8Wm'), 'verify: verifies correct hash');
-throws_ok { $pw->verify('3lJRlaRuOGWv/z3g1DAOlcH.u9vS8WM') } qr{Passwords did not match},
-'verify: does not verify invalid hash';
+throws_ok(
+ sub {
+ $pw->verify('3lJRlaRuOGWv/z3g1DAOlcH.u9vS8WM');
+ },
+ qr{Passwords did not match},
+ 'verify: does not verify invalid hash'
+);
ok($pw->verify($pw->crypt('truth')), 'crypt->verify okay')