tests(cmd): ensure wrong meta commands are recognized

This commit is contained in:
Khaïs COLIN 2025-05-03 21:21:59 +02:00
parent 848775587e
commit 32cfdfa07f
3 changed files with 21 additions and 2 deletions

View file

@ -13,7 +13,7 @@ CLOCK: [2025-05-03 sam. 18:40]--[2025-05-03 sam. 18:46] => 0:06
:END: :END:
** TODO OSDBError::display() should take a filename and display it alongside the error ** TODO OSDBError::display() should take a filename and display it alongside the error
* TODO snapshot testing * DONE snapshot testing
** DONE Find the snapshot testing library ** DONE Find the snapshot testing library
:PROPERTIES: :PROPERTIES:
@ -74,10 +74,13 @@ CLOCK: [2025-05-03 sam. 21:16]--[2025-05-03 sam. 21:18] => 0:02
:LOGBOOK: :LOGBOOK:
CLOCK: [2025-05-03 sam. 21:18]--[2025-05-03 sam. 21:21] => 0:03 CLOCK: [2025-05-03 sam. 21:18]--[2025-05-03 sam. 21:21] => 0:03
:END: :END:
** TODO insta test wrong meta-command ** DONE insta test wrong meta-command
:PROPERTIES: :PROPERTIES:
:EFFORT: 10min :EFFORT: 10min
:END: :END:
:LOGBOOK:
CLOCK: [2025-05-03 sam. 21:21]--[2025-05-03 sam. 21:22] => 0:01
:END:
* DONE exit message is not displayed when pressing C-d :bug: * DONE exit message is not displayed when pressing C-d :bug:
:PROPERTIES: :PROPERTIES:

View file

@ -133,4 +133,9 @@ mod tests {
fn test_parse_wrong_statement() { fn test_parse_wrong_statement() {
assert_debug_snapshot!("salact".parse::<Command>()); assert_debug_snapshot!("salact".parse::<Command>());
} }
#[test]
fn test_parse_wrong_meta_command() {
assert_debug_snapshot!(".halp".parse::<Command>());
}
} }

View file

@ -0,0 +1,11 @@
---
source: src/command.rs
expression: "\".halp\".parse::<Command>()"
---
Err(
MetaCommand(
Unrecognized {
cmd: ".halp",
},
),
)