Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Speed up the large diff highlighting test (#39025)

Charlie Marshc6ba7b7f8e88
diff --git a/codex-rs/tui/src/diff_render.rs b/codex-rs/tui/src/diff_render.rs
index 80643d12f7..f9e3b034a1 100644
--- a/codex-rs/tui/src/diff_render.rs
+++ b/codex-rs/tui/src/diff_render.rs
@@ -2446,18 +2446,11 @@ mod tests {
fn large_update_diff_skips_highlighting() {
// Build a patch large enough to exceed MAX_HIGHLIGHT_LINES (10_000).
// Without the pre-check this would attempt 10k+ parser initializations.
- let line_count = 10_500;
- let original: String = (0..line_count).map(|i| format!("line {i}\n")).collect();
- let modified: String = (0..line_count)
- .map(|i| {
- if i % 2 == 0 {
- format!("line {i} changed\n")
- } else {
- format!("line {i}\n")
- }
- })
- .collect();
- let patch = diffy::create_patch(&original, &modified).to_string();
+ let line_count = 10_001;
+ let patch = format!(
+ "--- a/huge.rs\n+++ b/huge.rs\n@@ -0,0 +1,{line_count} @@\n{}",
+ "+let value = 1;\n".repeat(line_count)
+ );
let mut changes: HashMap<PathBuf, FileChange> = HashMap::new();
changes.insert(