roc/crates/compiler/test_syntax/fuzz/fuzz_targets/fuzz_expr.rs
Joshua Warner 4f32f43048
Implement block / indent based parsing
... and enforce that defs can only occur in blocks (or, inside parenthesized expressions)
2024-07-27 13:34:16 -07:00

18 lines
484 B
Rust

#![no_main]
use bumpalo::Bump;
use libfuzzer_sys::fuzz_target;
use roc_parse::ast::Malformed;
use test_syntax::test_helpers::Input;
fuzz_target!(|data: &[u8]| {
if let Ok(input) = std::str::from_utf8(data) {
let input = Input::Expr(input);
let arena = Bump::new();
let ast = input.parse_in(&arena);
if let Ok(ast) = ast {
if !ast.is_malformed() {
input.check_invariants(|_| (), true);
}
}
}
});