just/tests
2024-07-14 22:15:22 -07:00
..
completions
allow_duplicate_recipes.rs
allow_duplicate_variables.rs
assert_stdout.rs
assert_success.rs
assertions.rs Add assert expression (#1845) 2024-05-15 01:55:32 +00:00
assignment.rs Improve error message if if is missing the else (#1252) 2022-06-30 10:34:11 +00:00
attributes.rs
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
confirm.rs Allow setting custom confirm prompt (#1834) 2024-01-13 02:44:13 +00:00
constants.rs Add predefined constants (#2054) 2024-05-18 23:12:11 +00:00
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
dotenv.rs
edit.rs Remove dependency on cradle (#2169) 2024-06-18 02:42:16 +00:00
equals.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
error_messages.rs
evaluate.rs Add / operator (#1237) 2022-06-25 09:39:06 +00:00
examples.rs
export.rs
fallback.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
fmt.rs Allow enabling unstable features with set unstable (#2237) 2024-07-08 03:45:03 +00:00
functions.rs
global.rs
groups.rs
ignore_comments.rs
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
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 Allow [doc] annotation on modules (#2247) 2024-07-14 22:15:22 -07:00
os_attributes.rs Add OS Configuration Attributes (#1387) 2022-10-31 00:52:03 -07:00
parser.rs
positional_arguments.rs
private.rs
quiet.rs Add set quiet and [no-quiet] (#1704) 2024-01-12 20:38:23 +00:00
quote.rs Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
readme.rs Cleanup (#2026) 2024-05-14 20:07:41 -07:00
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 Allow recipe parameters to shadow variables (#1480) 2023-01-10 00:59:02 +00:00
shebang.rs
shell_expansion.rs Stabilize modules (#2250) 2024-07-14 21:22:03 +00:00
shell.rs Test shell not found error messages (#2145) 2024-06-11 13:10:32 -07:00
show.rs
slash_operator.rs
string.rs
subsequents.rs
summary.rs
tempdir.rs
test.rs
timestamps.rs Add --timestamp-format (#2106) 2024-05-29 09:28:45 +00:00
undefined_variables.rs
unexport.rs
unstable.rs
windows_shell.rs Fix spelling (#1463) 2022-12-30 20:36:08 +00:00
windows.rs
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);
  }
}