ACP champagne (#35609)
cherry pick changes from #35510 onto latest main Release Notes: - N/A --------- Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
parent
69794db331
commit
eb4b73b88e
31 changed files with 2361 additions and 67 deletions
|
@ -962,7 +962,7 @@ mod tests {
|
|||
);
|
||||
cx.run_until_parked();
|
||||
|
||||
model.stream_last_completion_response("<old_text>a");
|
||||
model.send_last_completion_stream_text_chunk("<old_text>a");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(drain_events(&mut events), vec![]);
|
||||
assert_eq!(
|
||||
|
@ -974,7 +974,7 @@ mod tests {
|
|||
None
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("bc</old_text>");
|
||||
model.send_last_completion_stream_text_chunk("bc</old_text>");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
drain_events(&mut events),
|
||||
|
@ -996,7 +996,7 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("<new_text>abX");
|
||||
model.send_last_completion_stream_text_chunk("<new_text>abX");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(drain_events(&mut events), [EditAgentOutputEvent::Edited]);
|
||||
assert_eq!(
|
||||
|
@ -1011,7 +1011,7 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("cY");
|
||||
model.send_last_completion_stream_text_chunk("cY");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(drain_events(&mut events), [EditAgentOutputEvent::Edited]);
|
||||
assert_eq!(
|
||||
|
@ -1026,8 +1026,8 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("</new_text>");
|
||||
model.stream_last_completion_response("<old_text>hall");
|
||||
model.send_last_completion_stream_text_chunk("</new_text>");
|
||||
model.send_last_completion_stream_text_chunk("<old_text>hall");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(drain_events(&mut events), vec![]);
|
||||
assert_eq!(
|
||||
|
@ -1042,8 +1042,8 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("ucinated old</old_text>");
|
||||
model.stream_last_completion_response("<new_text>");
|
||||
model.send_last_completion_stream_text_chunk("ucinated old</old_text>");
|
||||
model.send_last_completion_stream_text_chunk("<new_text>");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
drain_events(&mut events),
|
||||
|
@ -1061,8 +1061,8 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("hallucinated new</new_");
|
||||
model.stream_last_completion_response("text>");
|
||||
model.send_last_completion_stream_text_chunk("hallucinated new</new_");
|
||||
model.send_last_completion_stream_text_chunk("text>");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(drain_events(&mut events), vec![]);
|
||||
assert_eq!(
|
||||
|
@ -1077,7 +1077,7 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("<old_text>\nghi\nj");
|
||||
model.send_last_completion_stream_text_chunk("<old_text>\nghi\nj");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
drain_events(&mut events),
|
||||
|
@ -1099,8 +1099,8 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("kl</old_text>");
|
||||
model.stream_last_completion_response("<new_text>");
|
||||
model.send_last_completion_stream_text_chunk("kl</old_text>");
|
||||
model.send_last_completion_stream_text_chunk("<new_text>");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
drain_events(&mut events),
|
||||
|
@ -1122,7 +1122,7 @@ mod tests {
|
|||
})
|
||||
);
|
||||
|
||||
model.stream_last_completion_response("GHI</new_text>");
|
||||
model.send_last_completion_stream_text_chunk("GHI</new_text>");
|
||||
cx.run_until_parked();
|
||||
assert_eq!(
|
||||
drain_events(&mut events),
|
||||
|
@ -1367,7 +1367,9 @@ mod tests {
|
|||
cx.background_spawn(async move {
|
||||
for chunk in chunks {
|
||||
executor.simulate_random_delay().await;
|
||||
model.as_fake().stream_last_completion_response(chunk);
|
||||
model
|
||||
.as_fake()
|
||||
.send_last_completion_stream_text_chunk(chunk);
|
||||
}
|
||||
model.as_fake().end_last_completion_stream();
|
||||
})
|
||||
|
|
|
@ -1577,7 +1577,7 @@ mod tests {
|
|||
|
||||
// Stream the unformatted content
|
||||
cx.executor().run_until_parked();
|
||||
model.stream_last_completion_response(UNFORMATTED_CONTENT.to_string());
|
||||
model.send_last_completion_stream_text_chunk(UNFORMATTED_CONTENT.to_string());
|
||||
model.end_last_completion_stream();
|
||||
|
||||
edit_task.await
|
||||
|
@ -1641,7 +1641,7 @@ mod tests {
|
|||
|
||||
// Stream the unformatted content
|
||||
cx.executor().run_until_parked();
|
||||
model.stream_last_completion_response(UNFORMATTED_CONTENT.to_string());
|
||||
model.send_last_completion_stream_text_chunk(UNFORMATTED_CONTENT.to_string());
|
||||
model.end_last_completion_stream();
|
||||
|
||||
edit_task.await
|
||||
|
@ -1720,7 +1720,9 @@ mod tests {
|
|||
|
||||
// Stream the content with trailing whitespace
|
||||
cx.executor().run_until_parked();
|
||||
model.stream_last_completion_response(CONTENT_WITH_TRAILING_WHITESPACE.to_string());
|
||||
model.send_last_completion_stream_text_chunk(
|
||||
CONTENT_WITH_TRAILING_WHITESPACE.to_string(),
|
||||
);
|
||||
model.end_last_completion_stream();
|
||||
|
||||
edit_task.await
|
||||
|
@ -1777,7 +1779,9 @@ mod tests {
|
|||
|
||||
// Stream the content with trailing whitespace
|
||||
cx.executor().run_until_parked();
|
||||
model.stream_last_completion_response(CONTENT_WITH_TRAILING_WHITESPACE.to_string());
|
||||
model.send_last_completion_stream_text_chunk(
|
||||
CONTENT_WITH_TRAILING_WHITESPACE.to_string(),
|
||||
);
|
||||
model.end_last_completion_stream();
|
||||
|
||||
edit_task.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue