summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-04-04 18:51:15 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-04-04 18:51:15 +0200
commit3d68caa7e8e3a88f8444a4c8a5b6cd5d6d30463d (patch)
tree1c5fa7dbb63724269c965698663033b9fedcd75e /t
parente81eb890ae7539052787caed6bf72e527c8307f1 (diff)
Test::Exception -> Test::Fatal
Diffstat (limited to 't')
-rw-r--r--t/20-app-raps2-password.t51
-rw-r--r--t/29-app-raps2.t2
2 files changed, 27 insertions, 26 deletions
diff --git a/t/20-app-raps2-password.t b/t/20-app-raps2-password.t
index 56a6f4d..ae4f267 100644
--- a/t/20-app-raps2-password.t
+++ b/t/20-app-raps2-password.t
@@ -4,7 +4,7 @@ use warnings;
use 5.010;
use Test::More tests => 19;
-use Test::Exception;
+use Test::Fatal;
my $pw;
my $salt = 'abcdefghijklmnop';
@@ -12,24 +12,24 @@ my $pass = 'something';
use_ok('App::Raps2::Password');
-throws_ok(
- sub {
+like(
+ exception {
App::Raps2::Password->new();
},
qr{incorrect salt length},
'new() missing salt and passphrase'
);
-throws_ok(
- sub {
+like(
+ exception {
App::Raps2::Password->new(salt => $salt);
},
qr{no passphrase given},
'new() missing passphrase'
);
-throws_ok(
- sub {
+like(
+ exception {
App::Raps2::Password->new(
salt => $salt,
passphrase => q{}
@@ -39,16 +39,16 @@ throws_ok(
'new() missing passphrase'
);
-throws_ok(
- sub {
+like(
+ exception {
App::Raps2::Password->new(passphrase => $pass);
},
qr{incorrect salt length},
'new() missing salt'
);
-throws_ok(
- sub {
+like(
+ exception {
App::Raps2::Password->new(
passphrase => $pass,
salt => 'abcdefghijklmno',
@@ -58,8 +58,8 @@ throws_ok(
'new() salt one too short'
);
-throws_ok(
- sub {
+like(
+ exception {
App::Raps2::Password->new(
passphrase => $pass,
salt => $salt . 'z',
@@ -90,8 +90,8 @@ is($pw->decrypt($pw->encrypt('foo')), 'foo', 'encrypt->decrypt okay');
ok($pw->verify('3lJRlaRuOGWv/z3g1DAOlcH.u9vS8Wm'), 'verify: verifies correct hash');
-throws_ok(
- sub {
+like(
+ exception {
$pw->verify('3lJRlaRuOGWv/z3g1DAOlcH.u9vS8WM');
},
qr{Passwords did not match},
@@ -100,41 +100,42 @@ throws_ok(
ok($pw->verify($pw->crypt('truth')), 'crypt->verify okay');
-throws_ok(
- sub {
+like(
+ exception {
$pw->salt();
},
qr{incorrect salt length},
'salt: No argument',
);
-throws_ok(
- sub {
+like(
+ exception {
$pw->salt('');
},
qr{incorrect salt length},
'salt: Empty argument',
);
-throws_ok(
- sub {
+like(
+ exception {
$pw->salt('abcdefghijklmno');
},
qr{incorrect salt length},
'salt: One too short',
);
-throws_ok(
- sub {
+like(
+ exception {
$pw->salt($salt . 'z');
},
qr{incorrect salt length},
'salt: One too long',
);
-lives_ok(
- sub {
+is(
+ exception {
$pw->salt($salt);
},
+ undef,
'salt: Correct length',
);
diff --git a/t/29-app-raps2.t b/t/29-app-raps2.t
index c0baeac..cbb170e 100644
--- a/t/29-app-raps2.t
+++ b/t/29-app-raps2.t
@@ -4,7 +4,7 @@ use warnings;
use 5.010;
use Test::More tests => 4;
-use Test::Exception;
+use Test::Fatal;
use_ok('App::Raps2');