tests(meta): ensure .exit works

This commit is contained in:
Khaïs COLIN 2025-05-03 21:18:20 +02:00
parent 47f174fb25
commit 92c50d6b65
3 changed files with 20 additions and 3 deletions

View file

@ -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::<Command>::into(MetaCommand::Exit).execute());
}
}

View file

@ -0,0 +1,8 @@
---
source: src/command.rs
expression: "Into::<Command>::into(MetaCommand::Exit).execute()"
---
CommandExecuteResult {
should_exit: true,
msg: "",
}