File: clear.t

package info (click to toggle)
libauthen-passphrase-perl 0.008-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 376 kB
  • sloc: perl: 1,932; makefile: 2
file content (28 lines) | stat: -r--r--r-- 714 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use warnings;
use strict;

use Test::More tests => 49;

BEGIN { use_ok "Authen::Passphrase::Clear"; }

my $ppr = Authen::Passphrase::Clear->from_rfc2307("{CLEARTEXT}womble");
ok $ppr;
is $ppr->passphrase, "womble";
eval { Authen::Passphrase::Clear->from_rfc2307("{CRYPT}*"); };
isnt $@, "";

my @test_phrases = ("", qw(0 1 foo supercalifragilisticexpialidocious));

foreach my $rightphrase (@test_phrases) {
	$ppr = Authen::Passphrase::Clear->new($rightphrase);
	ok $ppr;
	foreach my $passphrase (@test_phrases) {
		ok ($ppr->match($passphrase) xor $passphrase ne $rightphrase);
	}
	is $ppr->passphrase, $rightphrase;
	eval { $ppr->as_crypt };
	isnt $@, "";
	is $ppr->as_rfc2307, "{CLEARTEXT}".$rightphrase;
}

1;