From b9c7bf6744fcbf30b988a50fd0b8c28e23f22d29 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 16:31:48 +0100 Subject: fix: always set XDG_CACHE_HOME in tests. We do NOT want to write in real directories during tests, but it's even worse if it's the user's directory. We really need a non-stupid cache abstraction. --- dhall/tests/spec.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'dhall/tests/spec.rs') diff --git a/dhall/tests/spec.rs b/dhall/tests/spec.rs index 79747a4..77d2aaa 100644 --- a/dhall/tests/spec.rs +++ b/dhall/tests/spec.rs @@ -598,6 +598,17 @@ fn run_test(test: &SpecTest) -> Result<()> { // Set environment variable for import tests. env::set_var("DHALL_TEST_VAR", "6 * 7"); + // 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 SpecTest { input: expr, output: expected, @@ -646,16 +657,6 @@ 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)?; } -- cgit v1.2.3