diff options
| author | Teddy Wing | 2016-04-23 06:56:00 -0400 |
|---|---|---|
| committer | Teddy Wing | 2016-04-23 06:56:00 -0400 |
| commit | 0327cc0b8b509248d61c08e57ee7ef69843db593 (patch) | |
| tree | 42dc08dc9923f922637c1a57fa71f6b74d86c364 /t | |
| parent | 0d3e1073e4a3f683b746a5248227c57004ba8cec (diff) | |
| parent | f8490d43dfa0ecea0bb4716d93067ec37c6212dc (diff) | |
| download | mutt-alias-auto-add-0327cc0b8b509248d61c08e57ee7ef69843db593.tar.bz2 | |
Merge branch 'specify-alias-file-on-command-line'
Diffstat (limited to 't')
| -rw-r--r-- | t/001-creates-a-new-alias-for-a-contact-with-an-existing-name.t | 14 |
1 files changed, 11 insertions, 3 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 index 2ab2fa3..26e8119 100644 --- 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 @@ -4,16 +4,23 @@ use strict; use warnings; use Test::More; +use File::Copy qw(copy); use feature qw(say); +my $tmp_file = "./testdata/tmp"; + +# Setup: make a temporary alias file +copy("./testdata/aliases", $tmp_file); + + # Append test alias to alises file -open(my $fh, '>>', './testaliases') or die; +open(my $fh, '>>', $tmp_file) or die; say $fh 'alias paris-numa NUMA Paris <communique@numa.co>'; close $fh; -my $output = `cat ./testdata/email | ./target/debug/alias-auto-add`; +my $output = `cat ./testdata/email | ./target/debug/alias-auto-add $tmp_file`; ok !$?; # Check that the program outputs the full email coming from STDIN @@ -29,7 +36,7 @@ ok !$?; # Check that the aliases file includes an alias for the address from the input email { - open(my $fh, '<', './testaliases') or die; + open(my $fh, '<', $tmp_file) or die; my $last_line; while (my $line = readline $fh) { @@ -43,6 +50,7 @@ ok !$?; # Teardown +unlink $tmp_file; done_testing; |
