summaryrefslogtreecommitdiff
path: root/dhall/src/tests.rs
diff options
context:
space:
mode:
authorNadrieril2020-05-17 17:05:25 +0100
committerGitHub2020-05-17 17:05:25 +0100
commitaaba9f7a1a6119443aa6a569e451e0e549e5bb37 (patch)
tree5672d51e4197ae465b19222abb1dfca9d7e0040f /dhall/src/tests.rs
parentfcce380d5b4588dc5934bc2e5448d1d981761b50 (diff)
parent6c26ae4aa828b8054b307033dc58a6dfb4dac1a0 (diff)
Merge pull request #165 from fteychene/feat/resolve_cache
Diffstat (limited to 'dhall/src/tests.rs')
-rw-r--r--dhall/src/tests.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs
index 468d550..08a4a4a 100644
--- a/dhall/src/tests.rs
+++ b/dhall/src/tests.rs
@@ -254,9 +254,11 @@ fn run_test_or_panic(test: Test) {
fn run_test(test: Test) -> Result<()> {
use self::Test::*;
// 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");
@@ -296,6 +298,16 @@ fn run_test(test: Test) -> Result<()> {
expected.compare_ui(parsed)?;
}
ImportSuccess(expr, expected) => {
+ // 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)?;
}