mirror of
https://github.com/casey/just.git
synced 2025-12-23 11:37:29 +00:00
This commit adds a `Loader` type, which can be used to load multiple source strings. This was done to support the work on modules, but coincidentally enabled consolidating errors, since now `Config::run` can take a `&Loader`, and in the event of an error, return and `Error` that borrows from loaded strings. Multiple error types have been consolidated, and a bunch of ad-hoc error printing was removed. |
||
|---|---|---|
| .. | ||
| assert_stdout.rs | ||
| assert_success.rs | ||
| choose.rs | ||
| command.rs | ||
| common.rs | ||
| completions.rs | ||
| conditional.rs | ||
| delimiters.rs | ||
| dotenv.rs | ||
| edit.rs | ||
| error_messages.rs | ||
| evaluate.rs | ||
| examples.rs | ||
| export.rs | ||
| fmt.rs | ||
| functions.rs | ||
| init.rs | ||
| interrupts.rs | ||
| invocation_directory.rs | ||
| lib.rs | ||
| misc.rs | ||
| positional_arguments.rs | ||
| quiet.rs | ||
| readme.rs | ||
| search.rs | ||
| shebang.rs | ||
| shell.rs | ||
| show.rs | ||
| string.rs | ||
| sublime_syntax.rs | ||
| subsequents.rs | ||
| tempdir.rs | ||
| test.rs | ||
| working_directory.rs | ||
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);
}
}