just/tests
2024-05-30 02:15:10 +00:00
..
completions
allow_duplicate_recipes.rs Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
allow_duplicate_variables.rs Add 'allow-duplicate-variables' setting (#1922) 2024-05-15 01:39:42 +00:00
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 Print multi-line doc comments before recipe in --list (#2090) 2024-05-25 18:12:55 -07:00
backticks.rs Fix output \r\n stripping (#2035) 2024-05-14 23:30:19 +00:00
byte_order_mark.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
changelog.rs
choose.rs Show submodule recipes in --choose (#2069) 2024-05-21 06:22:56 +00:00
command.rs Update clap to version 4 (#1924) 2024-05-14 20:29:40 -07:00
completions.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
conditional.rs
confirm.rs
constants.rs
delimiters.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
directories.rs
dotenv.rs
edit.rs Clean up error display (#1699) 2023-10-16 20:18:25 -07:00
equals.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
error_messages.rs Allow setting custom confirm prompt (#1834) 2024-01-13 02:44:13 +00:00
evaluate.rs
examples.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
export.rs
fallback.rs
fmt.rs Update clap to version 4 (#1924) 2024-05-14 20:29:40 -07:00
functions.rs
global.rs
groups.rs
ignore_comments.rs Fix function name typo (#1953) 2024-03-11 04:30:53 +00:00
imports.rs
init.rs
interrupts.rs Downgrade to TLS 1.2 in install script (#1536) 2023-01-27 02:49:03 +00:00
invocation_directory.rs
json.rs
lib.rs
line_prefixes.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
list.rs Don't display submodule recipes in --list (#2112) 2024-05-30 02:15:10 +00:00
man.rs
misc.rs
modules.rs
multibyte_char.rs
newline_escape.rs
no_aliases.rs
no_cd.rs
no_dependencies.rs Add --no-deps to skip running recipe dependencies (#1819) 2024-01-09 08:40:08 +00:00
no_exit_message.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
os_attributes.rs
parser.rs
positional_arguments.rs
private.rs Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
quiet.rs
quote.rs
readme.rs Cleanup (#2026) 2024-05-14 20:07:41 -07:00
recursion_limit.rs
regexes.rs
run.rs
search_arguments.rs Test passing dot as argument between justfiles (#1530) 2023-01-25 05:33:43 +00:00
search.rs
shadowing_parameters.rs
shebang.rs
shell_expansion.rs
shell.rs Misc fixes (#1700) 2023-10-17 03:07:09 +00:00
show.rs
slash_operator.rs
string.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
subsequents.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
summary.rs Print submodule recipes in --summary (#1794) 2023-12-29 03:06:48 +00:00
tempdir.rs Use cache dir for temporary files (#2067) 2024-05-21 00:04:42 +00:00
test.rs
timestamps.rs
undefined_variables.rs
unstable.rs
windows_shell.rs Fix spelling (#1463) 2022-12-30 20:36:08 +00:00
working_directory.rs Placate clippy (#1423) 2022-11-23 00:36:23 +00:00

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);
  }
}