mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-15 10:31:30 +00:00
Only conditionally fuzz canonicalize
This commit is contained in:
parent
853dd5725b
commit
5ebd6e0884
1 changed files with 7 additions and 1 deletions
|
|
@ -5,13 +5,19 @@ use roc_parse::ast::Malformed;
|
||||||
use test_syntax::test_helpers::Input;
|
use test_syntax::test_helpers::Input;
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| {
|
fuzz_target!(|data: &[u8]| {
|
||||||
|
let canonicalize_fuzz_config = if cfg!(feature = "fuzz_canonicalize") {
|
||||||
|
Some(false)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
if let Ok(input) = std::str::from_utf8(data) {
|
if let Ok(input) = std::str::from_utf8(data) {
|
||||||
let input = Input::Expr(input);
|
let input = Input::Expr(input);
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
let ast = input.parse_in(&arena);
|
let ast = input.parse_in(&arena);
|
||||||
if let Ok(ast) = ast {
|
if let Ok(ast) = ast {
|
||||||
if !ast.is_malformed() {
|
if !ast.is_malformed() {
|
||||||
input.check_invariants(|_| (), true, Some(false));
|
input.check_invariants(|_| (), true, canonicalize_fuzz_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue