blob: 2ab2fa31f07a7c62e2d8bba43fc395f8b1c65e15 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use feature qw(say);
# Append test alias to alises file
open(my $fh, '>>', './testaliases') or die;
say $fh 'alias paris-numa NUMA Paris <communique@numa.co>';
close $fh;
my $output = `cat ./testdata/email | ./target/debug/alias-auto-add`;
ok !$?;
# Check that the program outputs the full email coming from STDIN
{
open(my $fh, '<', './testdata/email') or die;
local $/ = undef;
my $email = <$fh>;
is $output, $email;
close $fh;
}
# Check that the aliases file includes an alias for the address from the input email
{
open(my $fh, '<', './testaliases') or die;
my $last_line;
while (my $line = readline $fh) {
$last_line = $line;
}
is $last_line, 'alias paris-numa-2 NUMA Paris <communication@numa.co>' . "\n";
close $fh;
}
# Teardown
done_testing;
|