mirror of
https://github.com/openai/codex.git
synced 2026-09-17 12:23:33 +00:00
Make compact unit snapshots Bazel-stable
This commit is contained in:
@@ -593,6 +593,15 @@ mod tests {
|
||||
use insta::assert_snapshot;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::Value;
|
||||
use std::path::Path;
|
||||
|
||||
fn assert_compact_snapshot(name: &str, rendered: String) {
|
||||
let mut settings = insta::Settings::clone_current();
|
||||
settings.set_snapshot_path(Path::new(env!("CARGO_MANIFEST_DIR")).join("src/snapshots"));
|
||||
settings.bind(|| {
|
||||
assert_snapshot!(name, rendered);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn content_items_to_text_joins_non_empty_segments() {
|
||||
@@ -1686,14 +1695,14 @@ keep me updated
|
||||
panic!("expected refreshed history to serialize as array");
|
||||
};
|
||||
|
||||
assert_snapshot!(
|
||||
assert_compact_snapshot(
|
||||
"process_compacted_history_reinject_summary_only_shapes",
|
||||
context_snapshot::format_labeled_items_snapshot(
|
||||
"When compaction output contains only a summary user message, canonical context is still reinserted before the summary.",
|
||||
&[("Refreshed History Layout", refreshed_items.as_slice())],
|
||||
&ContextSnapshotOptions::default()
|
||||
.render_mode(ContextSnapshotRenderMode::KindWithTextPrefix { max_chars: 64 }),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1771,14 +1780,14 @@ keep me updated
|
||||
panic!("expected refreshed history to serialize as array");
|
||||
};
|
||||
|
||||
assert_snapshot!(
|
||||
assert_compact_snapshot(
|
||||
"process_compacted_history_reinject_above_last_summary_shapes",
|
||||
context_snapshot::format_labeled_items_snapshot(
|
||||
"When compaction output has multiple summary-only user messages and no real user message, canonical context is reinserted above the last summary.",
|
||||
&[("Refreshed History Layout", refreshed_items.as_slice())],
|
||||
&ContextSnapshotOptions::default()
|
||||
.render_mode(ContextSnapshotRenderMode::KindWithTextPrefix { max_chars: 64 }),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user