bdf1c92251
Remove all manual tracking of which tokens would have been accepted by the parser in favor of having the parser add tokens that it checks for to a set of expected tokens, clearing them when it accepts a token, and using the current contents of the set in error messages. This is a massive improvement, and will make the parser easier to modify going forward. And, this actually solves my sole issue with hand-written parsers. Thanks to matklad on reddit for suggesting this! |
||
---|---|---|
.. | ||
choose.rs | ||
common.rs | ||
completions.rs | ||
dotenv.rs | ||
edit.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); } }