diff --git a/notes.org b/notes.org index 98b7884..c42db6f 100644 --- a/notes.org +++ b/notes.org @@ -60,10 +60,13 @@ CLOCK: [2025-05-03 sam. 21:02]--[2025-05-03 sam. 21:09] => 0:07 :LOGBOOK: CLOCK: [2025-05-03 sam. 21:15]--[2025-05-03 sam. 21:16] => 0:01 :END: -** TODO insta test .exit +** DONE insta test .exit :PROPERTIES: :EFFORT: 10min :END: +:LOGBOOK: +CLOCK: [2025-05-03 sam. 21:16]--[2025-05-03 sam. 21:18] => 0:02 +:END: ** TODO insta test wrong statement :PROPERTIES: :EFFORT: 10min diff --git a/src/command.rs b/src/command.rs index 1c7106a..4962ac3 100644 --- a/src/command.rs +++ b/src/command.rs @@ -6,6 +6,7 @@ pub enum Command { Statement(Statement), } +#[derive(Debug)] pub struct CommandExecuteResult { pub should_exit: bool, msg: String, @@ -104,8 +105,8 @@ impl std::str::FromStr for Command { #[cfg(test)] mod tests { - use crate::{command::Command, statements::Statement}; - use insta::assert_snapshot; + use crate::{command::Command, meta_commands::MetaCommand, statements::Statement}; + use insta::{assert_debug_snapshot, assert_snapshot}; #[test] fn test_execute_insert_statement() { @@ -120,4 +121,9 @@ mod tests { let result = statement.execute().display(); assert_snapshot!(result); } + + #[test] + fn test_execute_exit_metacommand() { + assert_debug_snapshot!(Into::::into(MetaCommand::Exit).execute()); + } } diff --git a/src/snapshots/osdb__command__tests__execute_exit_metacommand.snap b/src/snapshots/osdb__command__tests__execute_exit_metacommand.snap new file mode 100644 index 0000000..48cf26a --- /dev/null +++ b/src/snapshots/osdb__command__tests__execute_exit_metacommand.snap @@ -0,0 +1,8 @@ +--- +source: src/command.rs +expression: "Into::::into(MetaCommand::Exit).execute()" +--- +CommandExecuteResult { + should_exit: true, + msg: "", +}