Start making representation work
This commit is contained in:
@@ -3,6 +3,7 @@ use parser_combinator::combinators::repeated;
|
||||
use parser_combinator::primitives::{any_char, literal, literal_char, one_of, pred};
|
||||
use parser_combinator::sequence::seq;
|
||||
use parser_combinator::Parser;
|
||||
use parser_combinator::Representation;
|
||||
|
||||
use proptest::prelude::*;
|
||||
|
||||
@@ -53,6 +54,7 @@ impl<'a, T, P> JsonParser<'a, T> for P where P: Parser<&'a str, T, &'a str> {}
|
||||
fn json_null<'a>() -> impl JsonParser<'a, JsonValue> {
|
||||
literal("null").to(JsonValue::Null)
|
||||
}
|
||||
|
||||
fn json_bool<'a>() -> impl JsonParser<'a, JsonValue> {
|
||||
choice((
|
||||
literal("true").to(JsonValue::Bool(true)),
|
||||
@@ -234,3 +236,8 @@ fn parse_json_document() {
|
||||
let parsed_json = json_object().parse(test_json);
|
||||
assert!(parsed_json.is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_representations() {
|
||||
assert_eq!(json_null().representation(), Representation::new("null"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user