Debian Codegraph @

t/tempstuff.t

raw
1 #!/usr/bin/perl -w
2 use Test::More qw(no_plan);
3 use File::Path;
4 use strict;
5 use lib 't';
6 use_ok('Test::Qpsmtpd');
7
8 BEGIN { # need this to happen before anything else
9 my $cwd = `pwd`;
10 chomp($cwd);
11 open my $spooldir, '>', "./config.sample/spool_dir";
12 print $spooldir "$cwd/t/tmp";
13 close $spooldir;
14 }
15
16 ok(my ($smtpd, $conn) = Test::Qpsmtpd->new_conn(), "get new connection");
17
18 my ($spool_dir, $tempfile, $tempdir) =
19 ($smtpd->spool_dir, $smtpd->temp_file(), $smtpd->temp_dir());
20
21 ok($spool_dir =~ m!t/tmp/$!, "Located the spool directory");
22 ok($tempfile =~ /^$spool_dir/, "Temporary filename");
23 ok($tempdir =~ /^$spool_dir/, "Temporary directory");
24 ok(-d $tempdir, "And that directory exists");
25
26 unlink "./config.sample/spool_dir";
27 rmtree($spool_dir);