diff options
author | Nadrieril | 2020-06-25 16:31:48 +0100 |
---|---|---|
committer | Nadrieril | 2020-06-25 16:31:48 +0100 |
commit | b9c7bf6744fcbf30b988a50fd0b8c28e23f22d29 (patch) | |
tree | 36a8786cb158c676ebb32bbb8255a93297d07091 /dhall/tests | |
parent | 8719a9332eaab35ef671b954def018bc5dcddcf9 (diff) |
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.
Diffstat (limited to 'dhall/tests')
-rw-r--r-- | dhall/tests/spec.rs | 21 |
1 files changed, 11 insertions, 10 deletions
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)?; } |