From e502da276b4aac49d1ac3b8a8896aa2670a442fc Mon Sep 17 00:00:00 2001 From: fteychene Date: Tue, 12 May 2020 14:57:16 +0200 Subject: feat: Add cache resolution on resolve --- dhall/src/tests.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'dhall/src/tests.rs') 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)?; } -- cgit v1.2.3