From 0415bc0ce299dfc707b7f8dc2ee26ceb57bce84e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Nov 2020 21:35:58 +0000 Subject: Expose binary parsing in the API --- serde_dhall/tests/serde.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'serde_dhall/tests') diff --git a/serde_dhall/tests/serde.rs b/serde_dhall/tests/serde.rs index 4c184e7..1181f72 100644 --- a/serde_dhall/tests/serde.rs +++ b/serde_dhall/tests/serde.rs @@ -205,6 +205,27 @@ mod serde { assert!(from_str("List/length [True, 42]").parse::().is_err()); } + #[test] + fn test_file() { + assert_eq!( + serde_dhall::from_file( + "../dhall-lang/tests/parser/success/unit/BoolLitTrueA.dhall" + ) + .static_type_annotation() + .parse::() + .map_err(|e| e.to_string()), + Ok(true) + ); + assert_eq!( + serde_dhall::from_binary_file( + "../dhall-lang/tests/parser/success/unit/BoolLitTrueB.dhallb" + ) + .static_type_annotation() + .parse::() + .map_err(|e| e.to_string()), + Ok(true) + ); + } // TODO: test various builder configurations // In particular test cloning and reusing builder } -- cgit v1.2.3