File: global.rs

package info (click to toggle)
rust-just 1.43.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,068 kB
  • sloc: sh: 300; makefile: 6
file content (82 lines) | stat: -rw-r--r-- 1,814 bytes parent folder | download | duplicates (2)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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();
}

#[test]
#[cfg(all(unix, not(target_os = "macos")))]
fn case_insensitive() {
  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();
}