1
1
mirror of https://github.com/casey/just.git synced 2024-11-26 23:27:26 +03:00
just/tests
Casey Rodarmor 1f20ca6481
Warn if .env file is loaded in dotenv-load isn't explicitly set (#925)
If a `.env` file is found and loaded, but the `dotenv-load` setting hasn't been explicitly
set to true, print a warning to stderr. In approximately six months, `dotenv-load` will
change from defaulting to true to defaulting to false, which will be a potentially breaking
change in behavior for justfiles which elicit this warning.

See this issue for more details:

    https://github.com/casey/just/issues/469
2021-07-28 07:33:44 +00:00
..
assert_stdout.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
assert_success.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
choose.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
command.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
common.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
completions.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
conditional.rs Implement else if chaining (#910) 2021-07-20 01:21:46 +00:00
delimiters.rs Allow ignore line endings inside delimiters (#717) 2020-10-27 23:51:17 -07:00
dotenv.rs Warn if .env file is loaded in dotenv-load isn't explicitly set (#925) 2021-07-28 07:33:44 +00:00
edit.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
error_messages.rs Add conditional expressions (#714) 2020-10-26 18:16:42 -07:00
evaluate.rs Change --eval to print variable value only (#806) 2021-04-25 17:02:57 -07:00
examples.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
export.rs Add dotenv-load setting (#778) 2021-03-28 22:38:07 -07:00
fmt.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
functions.rs Add string manipulation functions (#888) 2021-07-03 19:39:45 +00:00
init.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
interrupts.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
invocation_directory.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
lib.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
misc.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
positional_arguments.rs Pass evaluated arguments as positional arguments (#810) 2021-05-02 10:25:43 +00:00
quiet.rs Turn = deprecation warning into a hard error (#780) 2021-03-28 23:39:23 -07:00
readme.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
search.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
shebang.rs Add shebang support for 'cmd.exe' (#828) 2021-05-16 00:33:41 -05:00
shell.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
show.rs Add loader and refactor errors (#917) 2021-07-26 01:26:06 -07:00
string.rs Reform and improve string literals (#793) 2021-04-05 21:28:37 -07:00
sublime_syntax.rs Add file_extensions to Sublime syntax file (#878) 2021-06-24 08:24:12 +00:00
subsequents.rs Add subsequent dependencies (#820) 2021-07-22 00:20:25 -07:00
tempdir.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
test.rs Warn if .env file is loaded in dotenv-load isn't explicitly set (#925) 2021-07-28 07:33:44 +00:00
working_directory.rs Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00

use crate::common::*;

#[test]
fn readme() {
  let mut justfiles = vec![];
  let mut current = None;

  for line in fs::read_to_string("README.adoc").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 == "```make" {
      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);
  }
}