From 3a82c04248377e58bf6e1347535c60526bfdb55e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 10 Apr 2023 10:01:44 +0200 Subject: [PATCH] Improve assertion message when buffer state diverges --- .../src/tests/randomized_integration_tests.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/collab/src/tests/randomized_integration_tests.rs b/crates/collab/src/tests/randomized_integration_tests.rs index fc491fd7f3..eb78ffd47a 100644 --- a/crates/collab/src/tests/randomized_integration_tests.rs +++ b/crates/collab/src/tests/randomized_integration_tests.rs @@ -981,7 +981,8 @@ fn check_consistency_between_clients(clients: &[(Rc, TestAppContext) guest_buffer.read_with(client_cx, |b, _| b.saved_version().clone()); assert_eq!( guest_saved_version, host_saved_version, - "guest saved version does not match host's for path {path:?} in project {project_id}", + "guest {} saved version does not match host's for path {path:?} in project {project_id}", + client.username ); let host_saved_version_fingerprint = @@ -990,26 +991,30 @@ fn check_consistency_between_clients(clients: &[(Rc, TestAppContext) guest_buffer.read_with(client_cx, |b, _| b.saved_version_fingerprint()); assert_eq!( guest_saved_version_fingerprint, host_saved_version_fingerprint, - "guest's saved fingerprint does not match host's for path {path:?} in project {project_id}", + "guest {} saved fingerprint does not match host's for path {path:?} in project {project_id}", + client.username ); let host_saved_mtime = host_buffer.read_with(host_cx, |b, _| b.saved_mtime()); let guest_saved_mtime = guest_buffer.read_with(client_cx, |b, _| b.saved_mtime()); assert_eq!( guest_saved_mtime, host_saved_mtime, - "guest's saved mtime does not match host's for path {path:?} in project {project_id}", + "guest {} saved mtime does not match host's for path {path:?} in project {project_id}", + client.username ); let host_is_dirty = host_buffer.read_with(host_cx, |b, _| b.is_dirty()); let guest_is_dirty = guest_buffer.read_with(client_cx, |b, _| b.is_dirty()); assert_eq!(guest_is_dirty, host_is_dirty, - "guest's dirty status does not match host's for path {path:?} in project {project_id}", + "guest {} dirty status does not match host's for path {path:?} in project {project_id}", + client.username ); let host_has_conflict = host_buffer.read_with(host_cx, |b, _| b.has_conflict()); let guest_has_conflict = guest_buffer.read_with(client_cx, |b, _| b.has_conflict()); assert_eq!(guest_has_conflict, host_has_conflict, - "guest's conflict status does not match host's for path {path:?} in project {project_id}", + "guest {} conflict status does not match host's for path {path:?} in project {project_id}", + client.username ); } }