tests(meta): ensure .exit works
This commit is contained in:
parent
47f174fb25
commit
92c50d6b65
3 changed files with 20 additions and 3 deletions
|
|
@ -60,10 +60,13 @@ CLOCK: [2025-05-03 sam. 21:02]--[2025-05-03 sam. 21:09] => 0:07
|
||||||
:LOGBOOK:
|
:LOGBOOK:
|
||||||
CLOCK: [2025-05-03 sam. 21:15]--[2025-05-03 sam. 21:16] => 0:01
|
CLOCK: [2025-05-03 sam. 21:15]--[2025-05-03 sam. 21:16] => 0:01
|
||||||
:END:
|
:END:
|
||||||
** TODO insta test .exit
|
** DONE insta test .exit
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:EFFORT: 10min
|
:EFFORT: 10min
|
||||||
:END:
|
:END:
|
||||||
|
:LOGBOOK:
|
||||||
|
CLOCK: [2025-05-03 sam. 21:16]--[2025-05-03 sam. 21:18] => 0:02
|
||||||
|
:END:
|
||||||
** TODO insta test wrong statement
|
** TODO insta test wrong statement
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:EFFORT: 10min
|
:EFFORT: 10min
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ pub enum Command {
|
||||||
Statement(Statement),
|
Statement(Statement),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct CommandExecuteResult {
|
pub struct CommandExecuteResult {
|
||||||
pub should_exit: bool,
|
pub should_exit: bool,
|
||||||
msg: String,
|
msg: String,
|
||||||
|
|
@ -104,8 +105,8 @@ impl std::str::FromStr for Command {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::{command::Command, statements::Statement};
|
use crate::{command::Command, meta_commands::MetaCommand, statements::Statement};
|
||||||
use insta::assert_snapshot;
|
use insta::{assert_debug_snapshot, assert_snapshot};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_execute_insert_statement() {
|
fn test_execute_insert_statement() {
|
||||||
|
|
@ -120,4 +121,9 @@ mod tests {
|
||||||
let result = statement.execute().display();
|
let result = statement.execute().display();
|
||||||
assert_snapshot!(result);
|
assert_snapshot!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_execute_exit_metacommand() {
|
||||||
|
assert_debug_snapshot!(Into::<Command>::into(MetaCommand::Exit).execute());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
source: src/command.rs
|
||||||
|
expression: "Into::<Command>::into(MetaCommand::Exit).execute()"
|
||||||
|
---
|
||||||
|
CommandExecuteResult {
|
||||||
|
should_exit: true,
|
||||||
|
msg: "",
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue