just/tests
2024-06-29 18:12:31 -07:00
..
completions Don't check in auto-generated completion scripts (#2120) 2024-06-01 23:26:41 +00:00
allow_duplicate_recipes.rs
allow_duplicate_variables.rs
assert_stdout.rs
assert_success.rs Add invocation_directory_native() (#1507) 2023-01-13 19:03:14 +00:00
assertions.rs
assignment.rs
attributes.rs Add [ATTRIBUTE: VALUE] shorthand (#2136) 2024-06-08 18:33:45 +00:00
backticks.rs
byte_order_mark.rs
changelog.rs Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
choose.rs
command.rs
completions.rs
conditional.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
confirm.rs
constants.rs
datetime.rs Add datetime() and datetime_utc() functions (#2167) 2024-06-14 22:48:34 -07:00
delimiters.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
directories.rs Add functions to return XDG base directories (#1822) 2024-01-11 23:50:04 +00:00
dotenv.rs
edit.rs
equals.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
error_messages.rs
evaluate.rs
examples.rs
export.rs
fallback.rs
fmt.rs Remove dependency on cradle (#2169) 2024-06-18 02:42:16 +00:00
functions.rs
global.rs
groups.rs List recipes by group in group justfile order with just --list --unsorted (#2164) 2024-06-15 03:04:47 +00:00
ignore_comments.rs
imports.rs Allow multiple imports of the same file in different modules (#2065) 2024-05-20 08:04:03 +00:00
init.rs
interrupts.rs
invocation_directory.rs
json.rs Give modules doc comments for --list (#2199) 2024-06-28 21:13:11 -07:00
lib.rs
line_prefixes.rs
list.rs
man.rs
misc.rs
modules.rs
multibyte_char.rs
newline_escape.rs
no_aliases.rs
no_cd.rs
no_dependencies.rs
no_exit_message.rs
os_attributes.rs Add OS Configuration Attributes (#1387) 2022-10-31 00:52:03 -07:00
parser.rs
positional_arguments.rs Add [positional-arguments] attribute (#2151) 2024-06-13 19:35:14 +00:00
private.rs Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
quiet.rs
quote.rs
readme.rs
recursion_limit.rs
regexes.rs
run.rs Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
search_arguments.rs
search.rs
shadowing_parameters.rs
shebang.rs
shell_expansion.rs
shell.rs
show.rs Fix fzf chooser preview with space-separated module paths (#2141) 2024-06-09 01:01:24 +00:00
slash_operator.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
string.rs
subsequents.rs
summary.rs
tempdir.rs
test.rs
timestamps.rs
undefined_variables.rs
unexport.rs
unstable.rs Allow unstable features to be enabled with environment variable (#1588) 2023-10-09 03:47:20 +00:00
windows_shell.rs Fix spelling (#1463) 2022-12-30 20:36:08 +00:00
windows.rs Test bare bash path in shebang on windows (#2144) 2024-06-13 19:19:22 +00:00
working_directory.rs

use super::*;

#[test]
fn readme() {
  let mut justfiles = Vec::new();
  let mut current = None;

  for line in fs::read_to_string("README.md").unwrap().lines() {
    if let Some(mut justfile) = current {
      if line == "```" {
        justfiles.push(justfile);
        current = None;
      } else {
        justfile += line;
        justfile += "\n";
        current = Some(justfile);
      }
    } else if line == "```just" {
      current = Some(String::new());
    }
  }

  for justfile in justfiles {
    let tmp = tempdir();

    let path = tmp.path().join("justfile");

    fs::write(path, justfile).unwrap();

    let output = Command::new(executable_path("just"))
      .current_dir(tmp.path())
      .arg("--dump")
      .output()
      .unwrap();

    assert_success(&output);
  }
}