just/tests
hyrious 014491d667
Some checks failed
CI / lint (push) Has been cancelled
CI / msrv (push) Has been cancelled
CI / pages (push) Has been cancelled
CI / test (macos-latest) (push) Has been cancelled
CI / test (ubuntu-latest) (push) Has been cancelled
CI / test (windows-latest) (push) Has been cancelled
Allow configuring cygpath with --cygpath and $JUST_CYGPATH (#2804)
2025-07-05 20:24:32 -07:00
..
completions Don't check in auto-generated completion scripts (#2120) 2024-06-01 23:26:41 +00:00
alias.rs Allow the target of aliases to be recipes in submodules (#2632) 2025-03-09 13:36:46 -07:00
alias_style.rs Configure alias style in --list with --alias-style (#2342) 2024-12-12 23:36:24 +00:00
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
allow_missing.rs Add --allow-missing to ignore missing recipe and submodule errors (#2460) 2024-11-23 20:22:01 +00:00
assert_stdout.rs Add invocation_directory_native() (#1507) 2023-01-13 19:03:14 +00:00
assert_success.rs Add && and || operators (#2444) 2024-11-01 00:54:46 +00:00
assertions.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
assignment.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
attributes.rs Add [metadata] recipe attribute (#2794) 2025-07-04 21:55:18 +00: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 Stabilize fallback (#1471) 2023-01-04 06:31:56 +00:00
choose.rs Add reasons to #[ignore] attributes (#2797) 2025-06-28 07:41:21 +00:00
command.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
completions.rs Group commands under dedicated heading in --help output (#2302) 2024-08-05 22:31:06 +00:00
conditional.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
confirm.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
constants.rs Add PATH_SEP and PATH_VAR_SEP constants (#2679) 2025-07-01 07:02:36 +00:00
datetime.rs Add datetime() and datetime_utc() functions (#2167) 2024-06-14 22:48:34 -07:00
delimiters.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
dependencies.rs Allow depending on recipes in submodules (#2672) 2025-07-03 22:43:05 +00:00
directories.rs Add functions to return XDG base directories (#1822) 2024-01-11 23:50:04 +00:00
dotenv.rs Add dotenv-override setting (#2785) 2025-07-01 07:21:52 +00:00
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 Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
evaluate.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
examples.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
explain.rs Print recipe doc string when--explain flag is passed (#2319) 2024-08-29 19:13:58 +00:00
export.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
fallback.rs Add --allow-missing to ignore missing recipe and submodule errors (#2460) 2024-11-23 20:22:01 +00:00
format.rs Improve signal handling (#2488) 2025-03-15 00:32:28 +00:00
functions.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
global.rs Make global justfile filename case-insensitive (#2802) 2025-07-01 13:17:42 -07:00
groups.rs Remove (no group) header before ungrouped recipes (#2268) 2024-07-21 23:41:29 +00:00
ignore_comments.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
imports.rs Allow duplicate imports (#2437) 2024-10-30 22:23:00 +00:00
init.rs Add just.systems link to --init justfile (#2776) 2025-06-15 01:12:13 +00:00
invocation_directory.rs Allow configuring cygpath with --cygpath and $JUST_CYGPATH (#2804) 2025-07-05 20:24:32 -07:00
json.rs Add [metadata] recipe attribute (#2794) 2025-07-04 21:55:18 +00:00
lib.rs Allow depending on recipes in submodules (#2672) 2025-07-03 22:43:05 +00:00
line_prefixes.rs Do use super::*; instead of use crate::common::*; (#1239) 2022-06-19 04:56:31 +00:00
list.rs Make --list-submodules require --list (#2622) 2025-02-07 18:47:41 +00:00
logical_operators.rs Add && and || operators (#2444) 2024-11-01 00:54:46 +00:00
man.rs Add --man subcommand (#2041) 2024-05-15 07:28:50 +00:00
misc.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
modules.rs Add --allow-missing to ignore missing recipe and submodule errors (#2460) 2024-11-23 20:22:01 +00:00
multibyte_char.rs Fix multibyte codepoint crash (#1243) 2022-06-21 00:24:13 +00:00
newline_escape.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
no_aliases.rs Add --no-aliases to hide aliases in --list (#1961) 2024-03-26 12:20:46 -07:00
no_cd.rs Add [no-cd] attribute (#1400) 2022-11-02 23:37:35 -07:00
no_dependencies.rs Add --no-deps to skip running recipe dependencies (#1819) 2024-01-09 08:40:08 +00:00
no_exit_message.rs Add no-exit-message Setting and [exit-message] attribute (#2568) 2025-01-22 01:00:20 +00:00
os_attributes.rs Add [openbsd] recipe attribute (#2497) 2024-12-02 01:01:34 +00:00
parameters.rs Star parameters may follow default parameters (#2660) 2025-03-08 18:08:15 +00:00
parser.rs Fix truncated bang operator error message (#2522) 2024-12-11 23:24:42 +00:00
positional_arguments.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
private.rs Allow [private] attribute on assignments (#2300) 2024-08-10 18:22:07 +00:00
quiet.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08: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 Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
regexes.rs Add regex mismatch conditional operator (#2490) 2024-12-10 18:23:48 -08:00
request.rs Add --request subcommand for testing (#2498) 2024-12-02 00:37:08 +00:00
run.rs Add --one flag to forbid multiple recipes from being invoked on the command line (#2374) 2024-09-21 05:25:52 +00:00
script.rs Keep multi-line shebangs together (#2276) 2024-07-31 02:21:41 +00:00
search.rs Lexiclean search directory so .. does not check the current directory (#2236) 2024-07-08 02:12:07 +00:00
search_arguments.rs Test passing dot as argument between justfiles (#1530) 2023-01-25 05:33:43 +00:00
shadowing_parameters.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
shebang.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
shell.rs Improve signal handling (#2488) 2025-03-15 00:32:28 +00:00
shell_expansion.rs Add && and || operators (#2444) 2024-11-01 00:54:46 +00:00
show.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
signals.rs Make global justfile filename case-insensitive (#2802) 2025-07-01 13:17:42 -07:00
slash_operator.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
string.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
subsequents.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
summary.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
tempdir.rs Add --tempdir command-line option (#2798) 2025-06-29 21:24:47 +00:00
test.rs Use Test struct instead of test! macro (#2642) 2025-02-26 09:26:43 -08:00
timestamps.rs Add --timestamp-format (#2106) 2024-05-29 09:28:45 +00:00
undefined_variables.rs Use box-drawing characters in error messages (#1798) 2023-12-29 21:25:30 +00:00
unexport.rs Fix unexport syntax conflicts (#2158) 2024-06-14 19:39:34 +00:00
unstable.rs Don't write justfiles unchanged by formatting (#2479) 2024-11-23 19:44:21 +00:00
which_function.rs Add tests for require() (#2594) 2025-01-22 19:57:11 +00:00
windows.rs Test bare bash path in shebang on windows (#2144) 2024-06-13 19:19:22 +00:00
windows_shell.rs Fix spelling (#1463) 2022-12-30 20:36:08 +00:00
working_directory.rs Add [working-directory] recipe attribute (#2438) 2024-11-27 23:52:44 +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);
  }
}