From 72473cc16ae64d136831aa01044d796a439e4b0f Mon Sep 17 00:00:00 2001 From: Test Date: Sat, 21 Mar 2026 18:28:33 +0100 Subject: [PATCH] test(mutants): add tests for 2 missed mutation targets in bazel lexer Catches both surviving mutants from cargo-mutants: - lex_carriage_return_newlines: verifies \r\n produces Newline tokens - lex_dot_token: verifies . produces Dot token 0 missed mutants remaining. Refs: TEST-006 Co-Authored-By: Claude Opus 4.6 (1M context) --- rivet-core/src/bazel.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/rivet-core/src/bazel.rs b/rivet-core/src/bazel.rs index 3262305..1dd05b1 100644 --- a/rivet-core/src/bazel.rs +++ b/rivet-core/src/bazel.rs @@ -1153,4 +1153,40 @@ module(name = "test", version = "0.1.0") // The module call should still be extracted. assert_eq!(module.name.as_deref(), Some("test")); } + + // rivet: verifies REQ-028 + #[test] + fn lex_carriage_return_newlines() { + // Test \r\n (Windows) line endings produce Newline tokens + let src = "module(\r\n name = \"test\"\r\n)\r\n"; + let tokens = lex(src); + let newline_count = tokens + .iter() + .filter(|t| t.kind == SyntaxKind::Newline) + .count(); + assert!( + newline_count >= 2, + "expected at least 2 newline tokens from \\r\\n, got {newline_count}" + ); + } + + // rivet: verifies REQ-028 + #[test] + fn lex_dot_token() { + // Test that dot (.) is lexed as its own token (used in method calls) + let src = "foo.bar"; + let tokens = lex(src); + let dot_tokens: Vec<_> = tokens + .iter() + .filter(|t| t.kind == SyntaxKind::Dot) + .collect(); + assert_eq!( + dot_tokens.len(), + 1, + "expected exactly 1 Dot token, got {}: {:?}", + dot_tokens.len(), + tokens.iter().map(|t| (t.kind, t.text)).collect::>() + ); + assert_eq!(dot_tokens[0].text, "."); + } }