just 1.55.1

🤖 Just a command runner
Documentation
use super::*;

#[test]
fn macos() {
  if cfg!(not(target_os = "macos")) {
    return;
  }
  let tempdir = tempdir();

  let path = tempdir.path().to_owned();

  Test::with_tempdir(tempdir)
    .write(
      "Library/Application Support/just/justfile",
      "
        @default:
          echo foo
      ",
    )
    .env("HOME", path.to_str().unwrap())
    .args(["--global-justfile"])
    .stdout("foo\n")
    .success();
}

#[test]
fn not_macos() {
  if cfg!(any(not(unix), target_os = "macos")) {
    return;
  }
  let tempdir = tempdir();

  let path = tempdir.path().to_owned();

  Test::with_tempdir(tempdir)
    .write(
      "just/justfile",
      "
        @default:
          echo foo
      ",
    )
    .env("XDG_CONFIG_HOME", path.to_str().unwrap())
    .args(["--global-justfile"])
    .stdout("foo\n")
    .success();
}

#[test]
fn unix() {
  if cfg!(not(unix)) {
    return;
  }
  let tempdir = tempdir();

  let path = tempdir.path().to_owned();

  let tempdir = Test::with_tempdir(tempdir)
    .write(
      "justfile",
      "
        @default:
          echo foo
      ",
    )
    .env("HOME", path.to_str().unwrap())
    .args(["--global-justfile"])
    .stdout("foo\n")
    .success()
    .tempdir;

  Test::with_tempdir(tempdir)
    .write(
      ".config/just/justfile",
      "
        @default:
          echo bar
      ",
    )
    .env("HOME", path.to_str().unwrap())
    .args(["--global-justfile"])
    .stdout("bar\n")
    .success();
}

#[test]
fn case_insensitive() {
  if cfg!(any(not(unix), target_os = "macos")) {
    return;
  }
  let tempdir = tempdir();

  let path = tempdir.path().to_owned();

  Test::with_tempdir(tempdir)
    .write(
      "just/JUSTFILE",
      "
        @default:
          echo foo
      ",
    )
    .env("XDG_CONFIG_HOME", path.to_str().unwrap())
    .args(["--global-justfile"])
    .stdout("foo\n")
    .success();
}