Skip to content

Commit

Permalink
fix(test): Filter invalid input more carefully
Browse files Browse the repository at this point in the history
changelog: ignore
  • Loading branch information
jan-ferdinand committed Dec 23, 2024
1 parent 875cd09 commit 60ba090
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions triton-isa/proptest-regressions/parser.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cc 345d745c7e33ab1b8513cc6c1bb6d2ea2b27bb61422fd3aa58804ded56b5ba82
7 changes: 7 additions & 0 deletions triton-isa/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,13 @@ pub(crate) mod tests {
instruction: String,
#[filter(#id.parse::<i128>().is_err())] id: String,
) {
// A valid ID followed by a comment is valid, and therefore not relevant here.
// This might be a monkey-patch, but I don't know how to generate better input.
if let Some(comment_idx) = id.find("//") {
let (id, _) = id.split_at(comment_idx);
prop_assume!(id.parse::<i128>().is_err());
}

// not using `NegativeTest`: different `id`s trigger different errors
let input = format!("{instruction} error_id {id}");
prop_assert!(parse(&input).is_err());
Expand Down

0 comments on commit 60ba090

Please sign in to comment.