mirror of
https://github.com/casey/just.git
synced 2024-11-23 20:15:05 +03:00
aa506fa5bd
Modify the lexer to keep track of opening `({[` and closing `]})` delimiters. When the lexer would emit an eol or indent outside of a recipe when there is at least one open delimiter, emit a whitespace token instead. This allows expressions to be split on multiple lines, like so: x := if 'a' == 'b' { 'x' } else { 'y' } This does not work inside of recipe body interpolations, although this restriction might relaxed in the future. |
||
---|---|---|
.. | ||
choose.rs | ||
common.rs | ||
completions.rs | ||
conditional.rs | ||
delimiters.rs | ||
dotenv.rs | ||
edit.rs | ||
error_messages.rs | ||
examples.rs | ||
init.rs | ||
interrupts.rs | ||
invocation_directory.rs | ||
lib.rs | ||
misc.rs | ||
readme.rs | ||
search.rs | ||
shell.rs | ||
test.rs | ||
working_directory.rs |
use std::{fs, process::Command}; use executable_path::executable_path; use test_utilities::{assert_success, tempdir}; #[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); } }