Skip to content

Commit 8950062

Browse files
author
bors-servo
authored
Auto merge of #392 - frewsxcv:frewsxcv-roundtrip, r=mbrubeck
Extend fuzz target to also do serialization. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/392) <!-- Reviewable:end -->
2 parents 766622a + 833fde6 commit 8950062

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
1515

1616
[[bin]]
1717
name = "parse"
18-
path = "fuzzers/parse.rs"
18+
path = "fuzz_targets/parse.rs"
1919

2020
[workspace]
2121
members = ["."]

fuzz/fuzzers/parse.rs renamed to fuzz/fuzz_targets/parse.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ use std::str;
55

66
fuzz_target!(|data: &[u8]| {
77
if let Ok(utf8) = str::from_utf8(data) {
8-
let _ = url::Url::parse(utf8);
8+
if let Ok(parsed) = url::Url::parse(utf8) {
9+
let as_str = parsed.as_str();
10+
assert_eq!(parsed, url::Url::parse(as_str).unwrap());
11+
}
912
}
1013
});

0 commit comments

Comments
 (0)