diff options
author | pcpthm <[email protected]> | 2019-03-21 17:06:48 +0000 |
---|---|---|
committer | pcpthm <[email protected]> | 2019-03-21 23:04:48 +0000 |
commit | 4c7142d0c9be90c8947deb788993d903b2e0a5d1 (patch) | |
tree | 0fc0ebe4aa7918e39b4e95d23ad192a0734f339a /crates/ra_syntax/fuzz | |
parent | e734190c24d2a5aca5b62c2b1ab7e6136017a25c (diff) |
Add fuzz test for reparsing
Diffstat (limited to 'crates/ra_syntax/fuzz')
-rw-r--r-- | crates/ra_syntax/fuzz/Cargo.toml | 5 | ||||
-rw-r--r-- | crates/ra_syntax/fuzz/fuzz_targets/reparse.rs | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_syntax/fuzz/Cargo.toml b/crates/ra_syntax/fuzz/Cargo.toml index c54d12813..613ad2857 100644 --- a/crates/ra_syntax/fuzz/Cargo.toml +++ b/crates/ra_syntax/fuzz/Cargo.toml | |||
@@ -11,6 +11,7 @@ cargo-fuzz = true | |||
11 | 11 | ||
12 | [dependencies] | 12 | [dependencies] |
13 | ra_syntax = { path = ".." } | 13 | ra_syntax = { path = ".." } |
14 | ra_text_edit = { path = "../../ra_text_edit" } | ||
14 | libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } | 15 | libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } |
15 | 16 | ||
16 | # Prevent this from interfering with workspaces | 17 | # Prevent this from interfering with workspaces |
@@ -20,3 +21,7 @@ members = ["."] | |||
20 | [[bin]] | 21 | [[bin]] |
21 | name = "parser" | 22 | name = "parser" |
22 | path = "fuzz_targets/parser.rs" | 23 | path = "fuzz_targets/parser.rs" |
24 | |||
25 | [[bin]] | ||
26 | name = "reparse" | ||
27 | path = "fuzz_targets/reparse.rs" | ||
diff --git a/crates/ra_syntax/fuzz/fuzz_targets/reparse.rs b/crates/ra_syntax/fuzz/fuzz_targets/reparse.rs new file mode 100644 index 000000000..45524d4c1 --- /dev/null +++ b/crates/ra_syntax/fuzz/fuzz_targets/reparse.rs | |||
@@ -0,0 +1,9 @@ | |||
1 | #![no_main] | ||
2 | use libfuzzer_sys::fuzz_target; | ||
3 | use ra_syntax::fuzz::CheckReparse; | ||
4 | |||
5 | fuzz_target!(|data: &[u8]| { | ||
6 | if let Some(check) = CheckReparse::from_data(data) { | ||
7 | check.run(); | ||
8 | } | ||
9 | }); | ||