diff options
| author | Teddy Wing | 2016-04-22 22:22:23 -0400 |
|---|---|---|
| committer | Teddy Wing | 2016-04-22 22:22:23 -0400 |
| commit | 0d3e1073e4a3f683b746a5248227c57004ba8cec (patch) | |
| tree | 739f3c4d0fa881ea0a243992d249c9c43d0b7ae5 /t/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t | |
| parent | b9f6915d1e92f77c002f05a1371941dd3e3dcb95 (diff) | |
| parent | c4302101fd44747e33e0d3b311e659f9467e3e18 (diff) | |
| download | mutt-alias-auto-add-0d3e1073e4a3f683b746a5248227c57004ba8cec.tar.bz2 | |
Merge branch 'integration-test'
Diffstat (limited to 't/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t')
| -rw-r--r-- | t/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/t/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t b/t/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t new file mode 100644 index 0000000..2ab2fa3 --- /dev/null +++ b/t/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t @@ -0,0 +1,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; |
