Expand description
Test harness for arborium grammar crates.
This crate provides utilities for testing tree-sitter grammars and their queries.
§Usage
In your grammar crate’s lib.rs tests:
ⓘ
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_grammar() {
arborium_test_harness::test_grammar(
language(),
"rust",
HIGHLIGHTS_QUERY,
INJECTIONS_QUERY,
LOCALS_QUERY,
env!("CARGO_MANIFEST_DIR"),
);
}
}Re-exports§
pub use arborium_highlight;pub use arborium_tree_sitter as tree_sitter;
Structs§
Constants§
- HIGHLIGHT_
NAMES - Standard highlight names used by arborium.
- HIGHLIGHT_
NAMES_ FULL - The complete list of capture names that arborium recognizes.
Functions§
- collect_
corpus_ cases - Parse every corpus file and yield a case per
=== test. - corpus_
files - Return all
.txtcorpus files for a grammar crate. - run_
corpus_ case - Execute a single corpus test case.
- run_
corpus_ case_ with_ tree - Run a corpus test case and return the parsed tree’s s-expression.
- run_
corpus_ file - Execute all tests defined in a single corpus file.
- test_
corpus - Runs corpus-style parsing tests for a grammar.
- test_
grammar - Tests a grammar by validating its queries and highlighting all samples.