chore: improve error message in some spots loading grammar.json
This commit is contained in:
parent
9a05739851
commit
c521e9c18e
2 changed files with 6 additions and 2 deletions
|
|
@ -86,6 +86,9 @@ pub fn get_test_language(name: &str, parser_code: &str, path: Option<&Path>) ->
|
|||
|
||||
pub fn get_test_grammar(name: &str) -> (String, Option<PathBuf>) {
|
||||
let dir = fixtures_dir().join("test_grammars").join(name);
|
||||
let grammar = fs::read_to_string(&dir.join("grammar.json")).unwrap();
|
||||
let grammar = fs::read_to_string(&dir.join("grammar.json")).expect(&format!(
|
||||
"Can't find grammar.json for test grammar {}",
|
||||
name
|
||||
));
|
||||
(grammar, Some(dir))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue