From d2cb787a137ad5f9192e13c02301b900aa9711c0 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Fri, 21 Oct 2022 00:00:23 -0700 Subject: [PATCH] Add test for recursive value in array Currently broken, need to fix --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index cc0c351..f9ec7b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,7 @@ mod tests { } fn json_value() -> impl JsonParser<'static, JsonValue> { - choice((json_null(), json_bool(), json_number(), json_string())) + choice((json_null(), json_bool(), json_number(), json_string(), json_array())) } #[test] @@ -131,6 +131,9 @@ mod tests { "" ) ); + assert_eq!(json_array().parse(r#"[8,null,[],5]"#).unwrap(), (JsonValue::Array(vec![ + JsonValue::Num(8.), JsonValue::Null, JsonValue::Array(vec![]), JsonValue::Num(5.) + ]), "")); assert_eq!( json_number().parse("-383").unwrap().0, JsonValue::Num(-383f64)