diff options
Diffstat (limited to 'cli/tests/integration/cache_tests.rs')
-rw-r--r-- | cli/tests/integration/cache_tests.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cli/tests/integration/cache_tests.rs b/cli/tests/integration/cache_tests.rs index 773f98f6b..f7d9fb486 100644 --- a/cli/tests/integration/cache_tests.rs +++ b/cli/tests/integration/cache_tests.rs @@ -48,3 +48,33 @@ itest!(ignore_require { output_str: Some(""), exit_code: 0, }); + +// This test only runs on linux, because it hardcodes the XDG_CACHE_HOME env var +// which is only used on linux. +#[cfg(target_os = "linux")] +#[test] +fn relative_home_dir() { + use tempfile::TempDir; + use test_util as util; + + let deno_dir = TempDir::new_in(util::testdata_path()).unwrap(); + let path = deno_dir.path().strip_prefix(util::testdata_path()).unwrap(); + + let mut deno_cmd = util::deno_cmd(); + let output = deno_cmd + .current_dir(util::testdata_path()) + .env("XDG_CACHE_HOME", path) + .env_remove("HOME") + .env_remove("DENO_DIR") + .arg("cache") + .arg("--reload") + .arg("--no-check") + .arg("002_hello.ts") + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + assert!(output.status.success()); + assert_eq!(output.stdout, b""); +} |