aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mod.rs34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 4e2b0d7..f92cf16 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -132,6 +132,29 @@ impl App {
#[cfg(test)]
mod tests {
use super::*;
+
+ #[test]
+ fn app_mode_display() {
+ assert_eq!(AppMode::Init.to_string(), "INIT");
+ assert_eq!(AppMode::Counter.to_string(), "COUNTER");
+ assert_eq!(AppMode::Exit.to_string(), "EXIT");
+ }
+
+ #[test]
+ fn exit() {
+ let mut app = App::default();
+ assert!(app.init_context().is_ok());
+
+ let res = app.exit();
+
+ assert!(res.is_ok());
+ assert_eq!(app.mode, AppMode::Exit);
+ }
+}
+
+#[cfg(test)]
+mod counter_tests {
+ use super::*;
use store::ContextError;
fn get_count(app: &App) -> Result<u8, ContextError> {
@@ -204,17 +227,6 @@ mod tests {
}
#[test]
- fn exit() {
- let mut app = App::default();
- assert!(app.init_context().is_ok());
-
- let res = app.exit();
-
- assert!(res.is_ok());
- assert_eq!(app.mode, AppMode::Exit);
- }
-
- #[test]
fn decrement_counter_error() {
let mut app = App::default();
assert!(app.init_context().is_ok());