Add parse_json.

This commit is contained in:
Stephen Chung
2022-09-29 22:46:59 +08:00
parent 6c777e68d3
commit e8fd965eba
9 changed files with 78 additions and 34 deletions

View File

@@ -276,6 +276,11 @@ fn test_map_json() -> Result<(), Box<EvalAltResult>> {
EvalAltResult::ErrorMismatchOutputType(..)
));
assert!(matches!(
*engine.parse_json("{a:42}", true).expect_err("should error"),
EvalAltResult::ErrorParsing(..)
));
assert!(matches!(
*engine
.parse_json("#{a:123}", true)