summaryrefslogtreecommitdiff
path: root/serde_dhall
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--serde_dhall/src/options/de.rs2
-rw-r--r--serde_dhall/tests/serde.rs19
2 files changed, 20 insertions, 1 deletions
diff --git a/serde_dhall/src/options/de.rs b/serde_dhall/src/options/de.rs
index fc8c6dc..30846a2 100644
--- a/serde_dhall/src/options/de.rs
+++ b/serde_dhall/src/options/de.rs
@@ -243,7 +243,7 @@ impl<'a, A> Deserializer<'a, A> {
let resolved = if self.allow_imports {
parsed.resolve(cx)?
} else {
- parsed.skip_resolve()?
+ parsed.skip_resolve(cx)?
};
let typed = match &T::get_annot(self.annot) {
None => resolved.typecheck(cx)?,
diff --git a/serde_dhall/tests/serde.rs b/serde_dhall/tests/serde.rs
index 1181f72..fe0bffb 100644
--- a/serde_dhall/tests/serde.rs
+++ b/serde_dhall/tests/serde.rs
@@ -226,6 +226,25 @@ mod serde {
Ok(true)
);
}
+
+ #[test]
+ fn test_import() {
+ assert_de(
+ "../dhall-lang/tests/parser/success/unit/BoolLitTrueA.dhall",
+ true,
+ );
+ assert_eq!(
+ serde_dhall::from_str(
+ "../dhall-lang/tests/parser/success/unit/BoolLitTrueA.dhall"
+ )
+ .imports(false)
+ .static_type_annotation()
+ .parse::<bool>()
+ .map_err(|e| e.to_string()),
+ Err("UnexpectedImport(Import { mode: Code, location: Local(Parent, FilePath { file_path: [\"dhall-lang\", \"tests\", \"parser\", \"success\", \"unit\", \"BoolLitTrueA.dhall\"] }), hash: None })".to_string())
+ );
+ }
+
// TODO: test various builder configurations
// In particular test cloning and reusing builder
}