summaryrefslogtreecommitdiff
path: root/dhall/src/tests.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-10 22:32:07 +0200
committerNadrieril2019-04-10 22:32:07 +0200
commit7740ec004c6d7e073358bf2be00b6c0006e4dd06 (patch)
tree8c7658d71fc0fcc5158ffe028bb6a9c10701f150 /dhall/src/tests.rs
parent88ac184e7e967c4a5e257c91598f647b8294d71c (diff)
Allow providing type for typechecking in API
Diffstat (limited to '')
-rw-r--r--dhall/src/tests.rs23
1 files changed, 11 insertions, 12 deletions
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index dede639..6b1c426 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -31,9 +31,6 @@ macro_rules! make_spec_test {
use crate::error::{Error, Result};
use crate::expr::Parsed;
-use crate::*;
-use dhall_core::*;
-use dhall_generator as dhall;
use std::path::PathBuf;
#[allow(dead_code)]
@@ -47,11 +44,6 @@ pub enum Feature {
TypeInferenceFailure,
}
-// Deprecated
-fn read_dhall_file<'i>(file_path: &str) -> Result<SubExpr<X, X>> {
- crate::imports::load_dhall_file(&PathBuf::from(file_path))
-}
-
fn parse_file_str<'i>(file_path: &str) -> Result<Parsed> {
Parsed::parse_file(&PathBuf::from(file_path))
}
@@ -134,11 +126,18 @@ pub fn run_test(base_path: &str, feature: Feature) {
.spawn(|| {
let expr_file_path = base_path.clone() + "A.dhall";
let expected_file_path = base_path + "B.dhall";
- let expr = read_dhall_file(&expr_file_path).unwrap();
- let expected =
- read_dhall_file(&expected_file_path).unwrap();
- typecheck::type_of(dhall::subexpr!(expr: expected))
+ let expr = parse_file_str(&expr_file_path)
+ .unwrap()
+ .resolve()
.unwrap();
+ let expected = parse_file_str(&expected_file_path)
+ .unwrap()
+ .resolve()
+ .unwrap()
+ .skip_typecheck()
+ .skip_normalize()
+ .into_type();
+ expr.typecheck_with(&expected).unwrap();
})
.unwrap()
.join()