summaryrefslogtreecommitdiff
path: root/dhall/src/tests.rs
diff options
context:
space:
mode:
authorfteychene2020-05-12 14:57:16 +0200
committerfteychene2020-05-15 00:52:53 +0200
commite502da276b4aac49d1ac3b8a8896aa2670a442fc (patch)
tree4c0f31158a5566a7a7f5ed9584a97eb4fa046eab /dhall/src/tests.rs
parentfcce380d5b4588dc5934bc2e5448d1d981761b50 (diff)
feat: Add cache resolution on resolve
Diffstat (limited to '')
-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)?;
}