From e68eb02d3698f78c32a1bf401c60f57c22fbc6de Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Thu, 22 Oct 2026 12:59:22 +0200 Subject: [PATCH] Cover proptest-only scanner and preprocessor paths deterministically --- src/preprocessor.rs | 8 ++++++++ src/scanner.rs | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/preprocessor.rs b/src/preprocessor.rs index 317b7abde..723788e70 100644 --- a/src/preprocessor.rs +++ b/src/preprocessor.rs @@ -1077,6 +1077,14 @@ END"; )); } + #[test] + fn a_qualifier_without_a_name_is_not_a_qualified_target() { + for body in ["BEGIN\n rec. := 1;\nEND", "BEGIN\n rec. = 1;\nEND"] { + let (out, _) = PlPgSqlPreprocessor::preprocess(body).expect("no qualified target"); + assert_eq!(out, body); + } + } + fn declared_default(body: &str) -> Option { let (_, ctx) = PlPgSqlPreprocessor::preprocess(body).expect("preprocess"); ctx.get_declaration("v") diff --git a/src/scanner.rs b/src/scanner.rs index 9d5b23ec4..80f90e023 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -445,6 +445,21 @@ mod tests { assert!(!Scanner::new("x").has_unterminated_dollar_quote()); } + #[test] + fn an_unterminated_string_runs_to_the_end() { + assert_eq!(Scanner::new("'abc ; x").find_in_code(b';'), None); + } + + #[test] + fn an_unterminated_block_comment_runs_to_the_end() { + assert_eq!(Scanner::new("/* a ; b").find_in_code(b';'), None); + } + + #[test] + fn a_digit_led_dollar_tag_is_a_placeholder() { + assert_eq!(Scanner::new("$1$ ; $1$").find_in_code(b';'), Some(4)); + } + /// A `$$` that is commented out or quoted opens nothing. #[test] fn a_dollar_quote_inside_another_span_is_not_unterminated() {