mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-08 03:08:48 +00:00
a37cd5ad43
As described in #61, fuzz testing some parts of this would be ~~fun~~ helpful. So, I started with the most trivial fuzzer I could think of: Put random stuff into File::parse and see what happens. To speed things up, I also did cp src/**/*.rs fuzz/corpus/parser/ in the `crates/libsyntax2/` directory (running the fuzzer once will generate the necessary directories).
12 lines
296 B
Rust
12 lines
296 B
Rust
#![no_main]
|
|
#[macro_use] extern crate libfuzzer_sys;
|
|
extern crate libsyntax2;
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
if let Ok(text) = std::str::from_utf8(data) {
|
|
let x = libsyntax2::File::parse(text);
|
|
let _ = x.ast();
|
|
let _ = x.syntax();
|
|
let _ = x.errors();
|
|
}
|
|
});
|