tests(cmd): ensure wrong statements are recognized

This commit is contained in:
Khaïs COLIN 2025-05-03 21:20:54 +02:00
parent 92c50d6b65
commit 848775587e
5 changed files with 26 additions and 1 deletions

View file

@ -1,6 +1,7 @@
use crate::meta_commands::{MetaCommand, MetaCommandExecuteResult, MetaCommandParseError};
use crate::statements::{Statement, StatementExecuteResult, StatementParseError};
#[derive(Debug)]
pub enum Command {
MetaCommand(MetaCommand),
Statement(Statement),
@ -45,6 +46,7 @@ impl Command {
}
}
#[derive(Debug)]
pub enum CommandParseError {
MetaCommand(MetaCommandParseError),
Statement(StatementParseError),
@ -126,4 +128,9 @@ mod tests {
fn test_execute_exit_metacommand() {
assert_debug_snapshot!(Into::<Command>::into(MetaCommand::Exit).execute());
}
#[test]
fn test_parse_wrong_statement() {
assert_debug_snapshot!("salact".parse::<Command>());
}
}