File: 010sanity.t

package info (click to toggle)
libnet-ssh-authorizedkeysfile-perl 0.18-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 228 kB
  • sloc: perl: 596; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (3)
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
29
30
31
32
33
34
35
#
# Test cases for pathetic abnormities
#
use Test::More;
use Net::SSH::AuthorizedKeysFile;
use File::Temp qw(tempfile);

my $tdir = "t";
$tdir = "../t" unless -d $tdir;
my $cdir = "$tdir/canned";

plan tests => 3;

my $keyfile = Net::SSH::AuthorizedKeysFile->new(
    file => "$cdir/ak-comments.txt",
);

is $keyfile->sanity_check(), 1, "sanity of regular file succeeds";

my($fh, $tmpfile) = tempfile( UNLINK => 1 );
my $string = ("a" x ($keyfile->{ridiculous_line_len} + 1));
print $fh "$string\n";
close $fh;

is $keyfile->sanity_check($tmpfile), undef, "check sanity of insane file";

($fh, $tmpfile) = tempfile( UNLINK => 1 );
$string = ("a" x ($keyfile->{ridiculous_line_len} / 2) . 
              "\n" .
              "a" x ($keyfile->{ridiculous_line_len} / 2)
             );
print $fh "$string\n";
close $fh;

is $keyfile->sanity_check($tmpfile), 1, "sanity of regular file succeeds";