aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests.rs
diff options
context:
space:
mode:
authorTeddy Wing2016-04-06 15:03:25 -0400
committerTeddy Wing2016-04-06 15:03:25 -0400
commit1639ce2d4dbbf7440f1366b263b95a775db5ac90 (patch)
treebd5f8cc91c8cb5af44bbc0bb6358ae8263ee5c63 /src/tests.rs
parentde3a9b7f68e1f1b368630f498dd338d8b50444c8 (diff)
downloadmutt-alias-auto-add-1639ce2d4dbbf7440f1366b263b95a775db5ac90.tar.bz2
test.rs: Split `build_alias` test into 5 separate tests
Instead of putting all our asserts in a single test function, make a function for each assert. This allows us to give our test functions more specific names based on what exactly we're testing, and produces better output from `cargo test`. Also, if one of those fails for whatever reason, it's nice to know it will do so with a meaningful name.
Diffstat (limited to 'src/tests.rs')
-rw-r--r--src/tests.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tests.rs b/src/tests.rs
index f5fb57f..2e43d35 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -1,27 +1,39 @@
use super::build_alias;
#[test]
-fn test_build_alias() {
+fn build_alias_with_only_email() {
assert_eq!(
"alias producer@765pro.ductions producer@765pro.ductions",
build_alias("From: producer@765pro.ductions")
);
+}
+#[test]
+fn build_alias_with_1_name() {
assert_eq!(
"alias decim Decim <decim@quindecim.jp>",
build_alias("From: Decim <decim@quindecim.jp>")
);
+}
+#[test]
+fn build_alias_with_2_names() {
assert_eq!(
"alias farnsworth-hubert Hubert Farnsworth <professor@planetexpress.com>",
build_alias("From: Hubert Farnsworth <professor@planetexpress.com>")
);
+}
+#[test]
+fn build_alias_with_3_names() {
assert_eq!(
"alias lab-harvard Harvard Innovation Lab <noreply@eventbrite.com>",
build_alias("From: Harvard Innovation Lab <noreply@eventbrite.com>")
);
+}
+#[test]
+fn build_alias_with_special_characters() {
assert_eq!(
"alias celty-ostrulson \"O'Strulson, Celty\" <celty@dollars.co>",
build_alias("From: \"O'Strulson, Celty\" <celty@dollars.co>")