Skip to content

Commit

Permalink
Add tests module
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Wagner <[email protected]>
  • Loading branch information
nwagner84 committed Aug 29, 2024
1 parent 5943f46 commit 4aa4cf7
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions crates/pica-format/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,20 +284,24 @@ where
}

#[cfg(test)]
mod regressions {
mod tests {
use super::*;

/// This bug was found by cargo-fuzz. For the complete data see
/// crash-1065da7d802c4cec5ff86325a5629a0e4736191d inside the
/// crates/pica-select/fuzz/regressions/ directory.
#[test]
fn test_parse_invalid_byte_seq() {
assert!(parse_string
.parse(&[
39, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 61, 92, 92, 4, 39,
])
.is_err());
mod regressions {
use super::*;

/// This bug was found by cargo-fuzz. For the complete data see
/// crash-1065da7d802c4cec5ff86325a5629a0e4736191d inside the
/// crates/pica-select/fuzz/regressions/ directory.
#[test]
fn test_parse_invalid_byte_seq() {
assert!(parse_string
.parse(&[
39, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 61, 92, 92, 4, 39,
])
.is_err());
}
}
}

0 comments on commit 4aa4cf7

Please sign in to comment.