Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1496 from tree-sitter/query-randomized-tests
Introduce randomized testing for queries, fix the revealed bugs
- Loading branch information
Showing
10 changed files
with
673 additions
and
178 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,32 @@ | ||
pub(super) mod edits; | ||
pub(super) mod fixtures; | ||
pub(super) mod query_helpers; | ||
pub(super) mod random; | ||
pub(super) mod scope_sequence; | ||
|
||
use lazy_static::lazy_static; | ||
use std::{env, time, usize}; | ||
|
||
lazy_static! { | ||
pub static ref SEED: usize = { | ||
let seed = env::var("TREE_SITTER_TEST_SEED") | ||
.map(|s| usize::from_str_radix(&s, 10).unwrap()) | ||
.unwrap_or( | ||
time::SystemTime::now() | ||
.duration_since(time::UNIX_EPOCH) | ||
.unwrap() | ||
.as_secs() as usize, | ||
); | ||
eprintln!("\n\nRandom seed: {}\n", seed); | ||
seed | ||
}; | ||
pub static ref LOG_ENABLED: bool = env::var("TREE_SITTER_TEST_ENABLE_LOG").is_ok(); | ||
pub static ref LOG_GRAPH_ENABLED: bool = env::var("TREE_SITTER_TEST_ENABLE_LOG_GRAPHS").is_ok(); | ||
pub static ref LANGUAGE_FILTER: Option<String> = | ||
env::var("TREE_SITTER_TEST_LANGUAGE_FILTER").ok(); | ||
pub static ref EXAMPLE_FILTER: Option<String> = | ||
env::var("TREE_SITTER_TEST_EXAMPLE_FILTER").ok(); | ||
pub static ref TRIAL_FILTER: Option<usize> = env::var("TREE_SITTER_TEST_TRIAL_FILTER") | ||
.map(|s| usize::from_str_radix(&s, 10).unwrap()) | ||
.ok(); | ||
} |
Oops, something went wrong.