fix(plan): perkuat fixture test log agar benar-benar uji squash_log
Ditemukan lewat trace manual (bukan implementer): fixture lama cuma punya 1 baris berpola error, di bawah ambang looks_log_shaped (>=3), jadi tanpa sadar selalu jatuh ke squash_generic -- test tetap lulus tapi tidak pernah menguji logika scoring/windowing squash_log sama sekali. Tambah baris error/warning lagi supaya jalur squash_log benar-benar terpakai. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
7ffdf44135
commit
682007a250
@@ -672,16 +672,28 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn log_like_output_keeps_error_lines_and_marks_omissions() {
|
fn log_like_output_keeps_error_lines_and_marks_omissions() {
|
||||||
|
// `looks_log_shaped` requires >= 3 lines matching error/warn/fail/
|
||||||
|
// panic/stack-frame patterns before routing to `squash_log` at
|
||||||
|
// all — a single error line isn't enough and would silently fall
|
||||||
|
// through to `squash_generic` instead, so this fixture needs at
|
||||||
|
// least 3 such lines, spread apart, to actually exercise
|
||||||
|
// squash_log's scoring/windowing logic (not just its fallback).
|
||||||
let mut lines = vec!["build started".to_string()];
|
let mut lines = vec!["build started".to_string()];
|
||||||
for i in 0..200 {
|
for i in 0..200 {
|
||||||
lines.push(format!("info: compiling module {i}"));
|
lines.push(format!("info: compiling module {i}"));
|
||||||
}
|
}
|
||||||
|
lines.push("error: something failed early in the build".to_string());
|
||||||
|
for i in 0..200 {
|
||||||
|
lines.push(format!("info: compiling module {}", i + 200));
|
||||||
|
}
|
||||||
|
lines.push("warning: deprecated api used somewhere".to_string());
|
||||||
lines.push("error: something failed at the end".to_string());
|
lines.push("error: something failed at the end".to_string());
|
||||||
let text = lines.join("\n");
|
let text = lines.join("\n");
|
||||||
assert!(text.len() > SQUASH_FLOOR_BYTES);
|
assert!(text.len() > SQUASH_FLOOR_BYTES);
|
||||||
|
|
||||||
let result = apply("bash", &text);
|
let result = apply("bash", &text);
|
||||||
|
|
||||||
|
assert!(result.contains("error: something failed early in the build"));
|
||||||
assert!(result.contains("error: something failed at the end"));
|
assert!(result.contains("error: something failed at the end"));
|
||||||
assert!(result.contains("lines omitted"));
|
assert!(result.contains("lines omitted"));
|
||||||
assert!(result.len() < text.len());
|
assert!(result.len() < text.len());
|
||||||
|
|||||||
Reference in New Issue
Block a user