From de3a9b7f68e1f1b368630f498dd338d8b50444c8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 6 Apr 2016 12:55:56 -0400 Subject: build_alias: Remove [,'"] characters Make the function a bit more DRY by taking the `push_str` calls out of the `if` block. Add a new test and some code to remove commas and quotes from aliases. --- src/tests.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/tests.rs') diff --git a/src/tests.rs b/src/tests.rs index eff385a..f5fb57f 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -21,4 +21,9 @@ fn test_build_alias() { "alias lab-harvard Harvard Innovation Lab ", build_alias("From: Harvard Innovation Lab ") ); + + assert_eq!( + "alias celty-ostrulson \"O'Strulson, Celty\" ", + build_alias("From: \"O'Strulson, Celty\" ") + ); } -- cgit v1.2.3