Merge pull request #2516 from ahlinc/debug-grammars-in-tests
Add `TREE_SITTER_GRAMMAR_DEBUG` env var to use debug grammars in tests
This commit is contained in:
commit
e0e0763d29
3 changed files with 13 additions and 2 deletions
1
.github/workflows/sanitize.yml
vendored
1
.github/workflows/sanitize.yml
vendored
|
|
@ -41,6 +41,7 @@ jobs:
|
|||
|
||||
- name: Run main tests with address sanitizer (ASAN)
|
||||
env:
|
||||
ASAN_OPTIONS: halt_on_error=1
|
||||
CFLAGS: -fsanitize=address
|
||||
RUSTFLAGS: -Zsanitizer=address
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ fn test_language_corpus(start_seed: usize, language_name: &str) {
|
|||
|
||||
let log_seed = env::var("TREE_SITTER_LOG_SEED").is_ok();
|
||||
|
||||
if log_seed {
|
||||
println!(" start seed: {}", start_seed);
|
||||
}
|
||||
|
||||
println!();
|
||||
for test in tests {
|
||||
println!(" {} example - {}", language_name, test.name);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use lazy_static::lazy_static;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{env, fs};
|
||||
use tree_sitter::Language;
|
||||
use tree_sitter_highlight::HighlightConfiguration;
|
||||
use tree_sitter_loader::Loader;
|
||||
|
|
@ -9,7 +9,13 @@ use tree_sitter_tags::TagsConfiguration;
|
|||
include!("./dirs.rs");
|
||||
|
||||
lazy_static! {
|
||||
static ref TEST_LOADER: Loader = Loader::with_parser_lib_path(SCRATCH_DIR.clone());
|
||||
static ref TEST_LOADER: Loader = {
|
||||
let mut loader = Loader::with_parser_lib_path(SCRATCH_DIR.clone());
|
||||
if env::var("TREE_SITTER_GRAMMAR_DEBUG").is_ok() {
|
||||
loader.use_debug_build(true);
|
||||
}
|
||||
loader
|
||||
};
|
||||
}
|
||||
|
||||
pub fn test_loader<'a>() -> &'a Loader {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue