2022-10-25 23:57:20 +00:00
|
|
|
use super::*;
|
|
|
|
|
2023-10-17 03:07:09 +00:00
|
|
|
pub(crate) fn tempdir() -> TempDir {
|
2021-07-03 21:26:59 +00:00
|
|
|
tempfile::Builder::new()
|
|
|
|
.prefix("just-test-tempdir")
|
|
|
|
.tempdir()
|
|
|
|
.expect("failed to create temporary directory")
|
|
|
|
}
|
2022-10-25 23:57:20 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_tempdir_is_set() {
|
|
|
|
Test::new()
|
|
|
|
.justfile(
|
|
|
|
"
|
|
|
|
set tempdir := '.'
|
|
|
|
foo:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
cat just*/foo
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.shell(false)
|
|
|
|
.tree(tree! {
|
|
|
|
foo: {
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.current_dir("foo")
|
2022-11-19 20:38:41 +00:00
|
|
|
.stdout(if cfg!(windows) {
|
|
|
|
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cat just*/foo
|
|
|
|
"
|
|
|
|
} else {
|
2022-10-25 23:57:20 +00:00
|
|
|
"
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
cat just*/foo
|
2022-11-19 20:38:41 +00:00
|
|
|
"
|
|
|
|
})
|
2022-10-25 23:57:20 +00:00
|
|
|
.run();
|
|
|
|
}
|