From 52553034ccea2e2705925a55b10da55ad90e86aa Mon Sep 17 00:00:00 2001 From: makesomethingshit Date: Sun, 29 Nov 2026 11:42:06 +0900 Subject: [PATCH] Web tests: assert the browser drop counts without explicit panics --- apps/vectorcraft-web/src/file_drops.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/vectorcraft-web/src/file_drops.rs b/apps/vectorcraft-web/src/file_drops.rs index 8c3fe8e539..1b98d7b57b 100644 --- a/apps/vectorcraft-web/src/file_drops.rs +++ b/apps/vectorcraft-web/src/file_drops.rs @@ -78,9 +78,10 @@ mod tests { ctx.run_ui(next, |ui| delivered.extend(drops.take(ui.ctx(), &position))).textures_delta.clear(); assert_eq!(shared_files.load(Ordering::Relaxed), 0, "the shared router must not see browser-owned drops"); - let [batch] = delivered.as_slice() else { panic!("the browser UI must receive exactly one batch") }; - let [file] = batch.files.as_slice() else { panic!("the browser UI must receive exactly one file") }; - assert!(Arc::ptr_eq(file, &svg)); + assert_eq!(delivered.len(), 1, "the browser UI must receive exactly one batch"); + let batch = &delivered[0]; + assert_eq!(batch.files.len(), 1, "the browser UI must receive exactly one file"); + assert!(Arc::ptr_eq(&batch.files[0], &svg)); assert_eq!((batch.pos, batch.shift), (expected_pos, expected_shift)); assert!(position.get().is_none()); }