test(varcon): Show bad Pos parsing

This commit is contained in:
Ed Page 2024-08-23 09:37:25 -05:00
parent a4494fe54f
commit 198f9d80e5

View file

@ -1227,6 +1227,78 @@ Entry {
comment: None, comment: None,
} }
"#]]
);
}
#[test]
fn test_pos_bad() {
// 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 C: practice / AV Cv: practise | <Bad>\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,
},
Type {
category: Canadian,
tag: None,
num: None,
},
],
word: "practice",
},
Variant {
types: [
Type {
category: American,
tag: Some(
Seldom,
),
num: None,
},
Type {
category: Canadian,
tag: Some(
Variant,
),
num: None,
},
],
word: "practise",
},
],
pos: None,
archaic: false,
note: false,
description: Some(
"<Bad>",
),
comment: None,
}
"#]] "#]]
); );
} }