diff --git a/notes.org b/notes.org index 7d047c4..c138cee 100644 --- a/notes.org +++ b/notes.org @@ -38,11 +38,12 @@ CLOCK: [2025-05-03 sam. 18:49]--[2025-05-03 sam. 18:57] => 0:08 :LOGBOOK: CLOCK: [2025-05-03 sam. 19:00]--[2025-05-03 sam. 19:05] => 0:05 :END: -** TODO insta test insert +** DONE insta test insert :PROPERTIES: :EFFORT: 10min :END: :LOGBOOK: +CLOCK: [2025-05-03 sam. 21:10]--[2025-05-03 sam. 21:14] => 0:04 CLOCK: [2025-05-03 sam. 19:08]--[2025-05-03 sam. 19:21] => 0:13 :END: *** DONE all display of command results must be made via a display method on CommandExecutionResult diff --git a/src/command.rs b/src/command.rs index 89e21cc..2138ff3 100644 --- a/src/command.rs +++ b/src/command.rs @@ -101,3 +101,16 @@ impl std::str::FromStr for Command { } } } + +#[cfg(test)] +mod tests { + use crate::{command::Command, statements::Statement}; + use insta::assert_snapshot; + + #[test] + fn test_execute_insert_statement() { + let statement: Command = Statement::Insert.into(); + let result = statement.execute().display(); + assert_snapshot!(result); + } +} diff --git a/src/snapshots/osdb__command__tests__execute_insert_statement.snap b/src/snapshots/osdb__command__tests__execute_insert_statement.snap new file mode 100644 index 0000000..89809d2 --- /dev/null +++ b/src/snapshots/osdb__command__tests__execute_insert_statement.snap @@ -0,0 +1,5 @@ +--- +source: src/command.rs +expression: result +--- +insert