From c54bc441ba49e89d928f0efe735d1b07736e953f Mon Sep 17 00:00:00 2001 From: Will Lillis Date: Tue, 16 Sep 2025 03:08:01 -0400 Subject: [PATCH] fix(test): include failing test's path in error message This helps when an empty folder was left behind in the corpus directory --- crates/cli/src/tests/corpus_test.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/cli/src/tests/corpus_test.rs b/crates/cli/src/tests/corpus_test.rs index 6d272f51..1ef63b31 100644 --- a/crates/cli/src/tests/corpus_test.rs +++ b/crates/cli/src/tests/corpus_test.rs @@ -1,5 +1,6 @@ use std::{collections::HashMap, env, fs}; +use anyhow::Context; use tree_sitter::Parser; use tree_sitter_proc_macro::test_with_seed; @@ -363,7 +364,14 @@ fn test_feature_corpus_files() { grammar_path = test_path.join("grammar.json"); } let error_message_path = test_path.join("expected_error.txt"); - let grammar_json = tree_sitter_generate::load_grammar_file(&grammar_path, None).unwrap(); + let grammar_json = tree_sitter_generate::load_grammar_file(&grammar_path, None) + .with_context(|| { + format!( + "Could not load grammar file for test language '{language_name}' at {}", + grammar_path.display() + ) + }) + .unwrap(); let generate_result = tree_sitter_generate::generate_parser_for_grammar(&grammar_json, Some((0, 0, 0)));