mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-23 05:54:41 +01:00
json-pawarser: test grammar::member
This commit is contained in:
parent
662cb8ba0e
commit
ef1a9f5029
|
@ -61,3 +61,17 @@ fn member(p: &mut Parser) -> Option<CompletedMarker> {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::grammar::{object::member, test_utils::gen_checks};
|
||||
|
||||
#[test]
|
||||
fn member_basic() {
|
||||
gen_checks! {member;
|
||||
r#""a": "b""# => r#"ROOT { MEMBER { MEMBER_NAME { STRING "\"a\""; } COLON ":"; WHITESPACE " "; MEMBER_VALUE { STRING "\"b\""; } } }"#,
|
||||
r#""a": 42"# => r#"ROOT { MEMBER { MEMBER_NAME { STRING "\"a\""; } COLON ":"; WHITESPACE " "; MEMBER_VALUE { NUMBER "42"; } } }"#,
|
||||
r#""a":"# => r#"ROOT { MEMBER { PARSE_ERR: MemberMissingValue { MEMBER_NAME { STRING "\"a\""; } COLON ":"; } } }"#
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue