aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2016-04-06 01:12:58 -0400
committerTeddy Wing2016-04-06 01:12:58 -0400
commit02688030cb7b1de5c63732b8b820017391bfd2a0 (patch)
treea4723464e79c07d7e4c13d7509b51dc9b8b03637 /src/main.rs
parent9b178d48e0aa218bdb2fccaf46f2ce40c3148c7e (diff)
downloadmutt-alias-auto-add-02688030cb7b1de5c63732b8b820017391bfd2a0.tar.bz2
Add a couple tests for `build_alias`
Create a new `tests` module. This lives in its own file. Not sure if this is idiomatic Rust, but I prefer the idea of my tests living in a different file from my code. This module gets included in `main.rs`. We `use` `build_alias` directly because it's currently a private function, so doing `use super::*` didn't import it. Not sure if I should be making it a public function in order to mitigate this. Add a couple of variant test cases to check the string transformation that this function should be doing.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 3e4a343..92ea8e1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,8 @@
use std::io::{self, BufRead};
+#[cfg(test)]
+mod tests;
+
fn handle_alias(s: &str) {
let alias = build_alias(s);
}