Skip to content

Commit 1e3d5bf

Browse files
Martin TailleferCopilot
andcommitted
test(templated_uri): skip mutants on percent_encode to avoid runner OOM
`cargo mutants` mutates the manual index advance `i += 1` in `percent_encode` into `i *= 1`, which never advances the loop index and spins the `while` loop forever, pushing `%XX` escapes into the output buffer until the process is killed for running out of memory. That hangs the mutation-testing runner (it is SIGTERM'd mid-run) instead of yielding a killable result. Mark the function `#[cfg_attr(test, mutants::skip)]`, matching the established convention for loop-counter mutants elsewhere in the workspace. The encoder's output is already pinned by the differential, pseudo-random fuzz, exact-hex, and re-validation tests in the same module. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 10499452-0720-40ab-9e9f-506e1fd3ccaf
1 parent 31dbe74 commit 1e3d5bf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

crates/templated_uri/src/escaped.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ fn first_reserved(bytes: &[u8]) -> Option<usize> {
274274
/// in bulk via `push_str` (no per-character formatting), and each reserved byte is emitted
275275
/// as a `%XX` escape using a direct hex table. All slice boundaries fall on unreserved
276276
/// ASCII bytes, so the `&str` indexing is always valid.
277+
// The manual index advance (`i += 1`) mutates to `i *= 1`, which never advances `i` and spins
278+
// the `while` loop forever, pushing to `out` until the process runs out of memory. That hangs the mutation
279+
// runner rather than producing a killable diff, so the function is skipped; its output is
280+
// pinned by the differential/fuzz/exact-hex and re-validation tests in this module instead.
281+
#[cfg_attr(test, mutants::skip)]
277282
fn percent_encode(s: &str, first: usize) -> String {
278283
const HEX: &[u8; 16] = b"0123456789ABCDEF";
279284

0 commit comments

Comments
 (0)