File: tempstuff.t

package info (click to toggle)
qpsmtpd 0.32-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 860 kB
  • ctags: 237
  • sloc: perl: 4,219; sh: 592; makefile: 54
file content (27 lines) | stat: -rw-r--r-- 774 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/perl -w
use Test::More qw(no_plan);
use File::Path;
use strict;
use lib 't';
use_ok('Test::Qpsmtpd');

BEGIN { # need this to happen before anything else
    my $cwd = `pwd`;
    chomp($cwd);
    open my $spooldir, '>', "./config.sample/spool_dir";
    print $spooldir "$cwd/t/tmp";
    close $spooldir;
}

ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");

my ($spool_dir,$tempfile,$tempdir) = ( $smtpd->spool_dir,
$smtpd->temp_file(), $smtpd->temp_dir() );

ok( $spool_dir =~ m!t/tmp/$!, "Located the spool directory");
ok( $tempfile =~ /^$spool_dir/, "Temporary filename" );
ok( $tempdir =~ /^$spool_dir/, "Temporary directory" );
ok( -d $tempdir, "And that directory exists" );

unlink "./config.sample/spool_dir";
rmtree($spool_dir);