summaryrefslogtreecommitdiff
path: root/dhall/tests
diff options
context:
space:
mode:
authorNadrieril2020-06-24 21:52:03 +0100
committerNadrieril2020-06-24 22:13:53 +0100
commit23841922f0fdbb5d2eba9a0651cd46de86d96305 (patch)
treebf10646c5ee01c04f675d9cad73ada022f877d9e /dhall/tests
parentbef786fe2ffbbd714e4c0e8e63ac96a394201feb (diff)
refactor: remove old test harness
Diffstat (limited to 'dhall/tests')
-rw-r--r--dhall/tests/spec.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/dhall/tests/spec.rs b/dhall/tests/spec.rs
index ca09ef0..628f084 100644
--- a/dhall/tests/spec.rs
+++ b/dhall/tests/spec.rs
@@ -470,8 +470,6 @@ fn define_features() -> Vec<TestFeature> {
variant: SpecTestKind::ImportSuccess,
exclude_path: Rc::new(|path: &str| {
false
- // TODO: import hash
- || path == "hashFromCache"
// TODO: the standard does not respect https://tools.ietf.org/html/rfc3986#section-5.2
|| path == "unit/asLocation/RemoteCanonicalize4"
// TODO: import headers
@@ -579,9 +577,11 @@ fn run_test_or_panic(test: &SpecTest) {
fn run_test(test: &SpecTest) -> Result<()> {
use self::SpecTestKind::*;
// Setup current directory to the root of the repository. Important for `as Location` tests.
- env::set_current_dir(
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).parent().unwrap(),
- )?;
+ let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+ .parent()
+ .unwrap()
+ .to_path_buf();
+ env::set_current_dir(root_dir.as_path())?;
// Set environment variable for import tests.
env::set_var("DHALL_TEST_VAR", "6 * 7");
@@ -626,6 +626,16 @@ fn run_test(test: &SpecTest) -> Result<()> {
expected.compare_ui(parsed)?;
}
ImportSuccess => {
+ // Configure cache for import tests
+ env::set_var(
+ "XDG_CACHE_HOME",
+ root_dir
+ .join("dhall-lang")
+ .join("tests")
+ .join("import")
+ .join("cache")
+ .as_path(),
+ );
let expr = expr.normalize()?;
expected.compare(expr)?;
}