From 60ba090c1b4060fe2b4a75cf43b5fe057a00dfd8 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Mon, 23 Dec 2024 09:46:50 +0100 Subject: [PATCH] fix(test): Filter invalid input more carefully changelog: ignore --- triton-isa/proptest-regressions/parser.txt | 1 + triton-isa/src/parser.rs | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 triton-isa/proptest-regressions/parser.txt diff --git a/triton-isa/proptest-regressions/parser.txt b/triton-isa/proptest-regressions/parser.txt new file mode 100644 index 00000000..6e82cfa9 --- /dev/null +++ b/triton-isa/proptest-regressions/parser.txt @@ -0,0 +1 @@ +cc 345d745c7e33ab1b8513cc6c1bb6d2ea2b27bb61422fd3aa58804ded56b5ba82 diff --git a/triton-isa/src/parser.rs b/triton-isa/src/parser.rs index c155fad0..32210969 100644 --- a/triton-isa/src/parser.rs +++ b/triton-isa/src/parser.rs @@ -1450,6 +1450,13 @@ pub(crate) mod tests { instruction: String, #[filter(#id.parse::().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::().is_err()); + } + // not using `NegativeTest`: different `id`s trigger different errors let input = format!("{instruction} error_id {id}"); prop_assert!(parse(&input).is_err());