aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-05-14 17:42:42 -0400
committerJesse Luehrs <doy@tozt.net>2018-05-14 17:42:42 -0400
commit1769620134a3ca3cddddbec13215736f489ec13b (patch)
treefc2cfef2361e68c50c854f863d95c7110d1c951a
parent3888214fe87b27be5d5423a5c80eb4f17958b9d2 (diff)
downloadfancy-prompt-1769620134a3ca3cddddbec13215736f489ec13b.tar.gz
fancy-prompt-1769620134a3ca3cddddbec13215736f489ec13b.zip
add a test that rendering works
as in, doesn't panic
-rw-r--r--src/main.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 84fceea..70c6adf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -30,3 +30,27 @@ fn main() {
talk_about_time!("displaying data");
stop_talking_about_time!();
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use chrono::TimeZone;
+
+ #[test]
+ fn test_render() {
+ let data = data::PromptData {
+ shell: colors::ShellType::Unknown,
+ error_code: 0,
+ hostname: Some(String::from("hush")),
+ terminal_cols: Some(80),
+ pwd: Some(std::path::PathBuf::from("/home/doy/coding/fancy-prompt")),
+ home: Some(std::path::PathBuf::from("/home/doy")),
+ user: Some(String::from("doy")),
+ is_root: false,
+ time: chrono::Local.ymd(2018, 5, 14).and_hms(17, 35, 45),
+ power_info: power::PowerInfo::new(),
+ vcs_info: None,
+ };
+ prompt::Prompt::new(data).display();
+ }
+}