Add test for recursive value in array

Currently broken, need to fix
This commit is contained in:
Greg Shuflin 2022-10-21 00:00:23 -07:00
parent 6633d10af0
commit d2cb787a13

View File

@ -110,7 +110,7 @@ mod tests {
} }
fn json_value() -> impl JsonParser<'static, JsonValue> { 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] #[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!( assert_eq!(
json_number().parse("-383").unwrap().0, json_number().parse("-383").unwrap().0,
JsonValue::Num(-383f64) JsonValue::Num(-383f64)