just/tests
2023-12-28 17:34:37 -08:00
..
completions
allow_duplicate_recipes.rs
assert_stdout.rs
assert_success.rs
assignment.rs
attributes.rs
byte_order_mark.rs
changelog.rs
choose.rs
command.rs
completions.rs
conditional.rs
confirm.rs
delimiters.rs
dotenv.rs
edit.rs
equals.rs
error_messages.rs
evaluate.rs
examples.rs
export.rs
fallback.rs Add file paths to error messages (#1737) 2023-11-22 04:17:38 +00:00
fmt.rs
functions.rs
ignore_comments.rs
imports.rs Override imported recipes (#1790) 2023-12-28 17:34:37 -08:00
init.rs
interrupts.rs
invocation_directory.rs
json.rs
lib.rs
line_prefixes.rs
misc.rs
modules.rs Run recipes with working directory set to submodule directory (#1788) 2023-12-29 00:55:36 +00:00
multibyte_char.rs
newline_escape.rs
no_cd.rs
no_exit_message.rs
os_attributes.rs
parser.rs
positional_arguments.rs
private.rs
quiet.rs
quote.rs
readme.rs
recursion_limit.rs
regexes.rs
run.rs
search_arguments.rs
search.rs
shadowing_parameters.rs
shebang.rs
shell.rs
show.rs
slash_operator.rs
string.rs
subsequents.rs
tempdir.rs
test.rs
undefined_variables.rs
unstable.rs
windows_shell.rs
working_directory.rs

use super::*;

#[test]
fn readme() {
  let mut justfiles = vec![];
  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);
  }
}