diff options
| author | Teddy Wing | 2016-04-23 03:10:56 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2016-04-23 03:10:56 -0400 | 
| commit | f8490d43dfa0ecea0bb4716d93067ec37c6212dc (patch) | |
| tree | 42dc08dc9923f922637c1a57fa71f6b74d86c364 /t | |
| parent | 56d5771a96ce93c535dfed252b3a755a15e52840 (diff) | |
| download | mutt-alias-auto-add-f8490d43dfa0ecea0bb4716d93067ec37c6212dc.tar.bz2 | |
Update integration test to use the better test alias file
Instead of using the temporary `./testaliases` alias file, use a copy of
the `./testdata/aliases` file.
We're able to do this with our new ability to specify our alias file as
the first argument to our executable.
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; | 
