From ad2d9e0e1fa965ef94fcbf6e239729008cc34ba2 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 17 Apr 2016 21:32:53 -0400 Subject: Create a function that will check whether an alias is in a file This will allow us to pass an alias and grep for it in a given file. Just a rough outline to start. Added a super basic test and a file in "testdata" to operate on for testing. --- src/tests.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/tests.rs') diff --git a/src/tests.rs b/src/tests.rs index 2e43d35..712b41e 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,4 +1,4 @@ -use super::build_alias; +use super::{build_alias, is_alias_in_file}; #[test] fn build_alias_with_only_email() { @@ -39,3 +39,12 @@ fn build_alias_with_special_characters() { build_alias("From: \"O'Strulson, Celty\" ") ); } + + +#[test] +fn is_alias_in_file_finds_a_match() { + is_alias_in_file( + "alias farnsworth-hubert Hubert Farnsworth ", + "./testdata/aliases" + ); +} -- cgit v1.2.3