-
Notifications
You must be signed in to change notification settings - Fork 499
/
global.rs
65 lines (55 loc) · 1.38 KB
/
global.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use super::*;
#[test]
#[cfg(target_os = "macos")]
fn macos() {
let tempdir = tempdir();
let path = tempdir.path().to_owned();
Test::with_tempdir(tempdir)
.no_justfile()
.test_round_trip(false)
.write(
"Library/Application Support/just/justfile",
"@default:\n echo foo",
)
.env("HOME", path.to_str().unwrap())
.args(["--global-justfile"])
.stdout("foo\n")
.run();
}
#[test]
#[cfg(all(unix, not(target_os = "macos")))]
fn not_macos() {
let tempdir = tempdir();
let path = tempdir.path().to_owned();
Test::with_tempdir(tempdir)
.no_justfile()
.test_round_trip(false)
.write("just/justfile", "@default:\n echo foo")
.env("XDG_CONFIG_HOME", path.to_str().unwrap())
.args(["--global-justfile"])
.stdout("foo\n")
.run();
}
#[test]
#[cfg(unix)]
fn unix() {
let tempdir = tempdir();
let path = tempdir.path().to_owned();
let tempdir = Test::with_tempdir(tempdir)
.no_justfile()
.test_round_trip(false)
.write("justfile", "@default:\n echo foo")
.env("HOME", path.to_str().unwrap())
.args(["--global-justfile"])
.stdout("foo\n")
.run()
.tempdir;
Test::with_tempdir(tempdir)
.no_justfile()
.test_round_trip(false)
.write(".config/just/justfile", "@default:\n echo bar")
.env("HOME", path.to_str().unwrap())
.args(["--global-justfile"])
.stdout("bar\n")
.run();
}