From e85562501a2ff86433fb331e82fdaf6eafa1a192 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 23 Aug 2024 11:25:08 -0500 Subject: [PATCH] test(varcon): Show basic abbr parsing --- crates/varcon-core/src/parser.rs | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/crates/varcon-core/src/parser.rs b/crates/varcon-core/src/parser.rs index cb430a9..8a12a78 100644 --- a/crates/varcon-core/src/parser.rs +++ b/crates/varcon-core/src/parser.rs @@ -1346,6 +1346,52 @@ Entry { comment: None, } +"#]] + ); + } + + #[test] + fn test_abbr() { + // Having nothing after `A` causes an incomplete parse. Shouldn't be a problem for my use + // cases. + let (input, actual) = Entry::parse_.parse_peek("A B: ha | \n").unwrap(); + assert_data_eq!( + input, + str![[r#" + + +"#]] + ); + assert_data_eq!( + actual.to_debug(), + str![[r#" +Entry { + variants: [ + Variant { + types: [ + Type { + category: American, + tag: None, + num: None, + }, + Type { + category: BritishIse, + tag: None, + num: None, + }, + ], + word: "ha", + }, + ], + pos: None, + archaic: false, + note: false, + description: Some( + "", + ), + comment: None, +} + "#]] ); }