M3.9: an edit that only allocates ids still counts as a change

`Project::same_content` ignored `next_id`, so an edit that only took an id was dropped as a
no-op and the id could be handed out again (an edit may keep it beyond the project).
`guard::tests::the_session_survives_a_panicking_edit`, merged after M3.9, failed on main for
this reason. Ids now count; setting a value to what it already is still records nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-05 06:43:10 +07:00
co-authored by Claude Opus 5.5
parent cb892b5239
commit a965d8df49
2 changed files with 7 additions and 5 deletions
+3 -2
View File
@@ -86,12 +86,13 @@ fn camera_and_light_layers_build() {
}
#[test]
fn same_content_ignores_unused_ids_and_sees_comp_edits() {
fn same_content_sees_allocated_ids_and_comp_edits() {
let (p, cid) = project_with_layer();
let mut q = p.clone();
assert!(q.same_content(&p));
q.alloc();
assert!(q.same_content(&p), "an allocated but unused id is not a change");
assert!(!q.same_content(&p), "an allocated id stays taken");
let mut q = p.clone();
// A comp copied on write but left equal is the same; a changed one is not.
let _ = q.comp_mut(cid).unwrap();
assert!(q.same_content(&p));