@@ -601,7 +601,7 @@ pub async fn assert_awkward_content_round_trips(provider: &dyn MemoryProvider) {
601601 ( "large" , "x" . repeat ( 64 * 1024 ) ) ,
602602 ( "newlines" , "a\n b\r \n c\0 d" . to_string ( ) ) ,
603603 ] ;
604- let mut accepted = 0usize ;
604+ let mut accepted: Vec < & str > = Vec :: new ( ) ;
605605 for ( key, content) in & cases {
606606 // A driver may refuse a shape outright — `MemoryCore::store` documents
607607 // `Invalid` "for caller input the driver rejects", and the TinyCortex
@@ -629,7 +629,7 @@ pub async fn assert_awkward_content_round_trips(provider: &dyn MemoryProvider) {
629629 {
630630 continue ;
631631 }
632- accepted += 1 ;
632+ accepted. push ( key ) ;
633633 if let Some ( got) = provider
634634 . get ( & ns, key)
635635 . await
@@ -638,12 +638,17 @@ pub async fn assert_awkward_content_round_trips(provider: &dyn MemoryProvider) {
638638 assert_eq ! ( & got. content, content, "{who}: `{key}` content was mangled" ) ;
639639 }
640640 }
641- // Without this a driver that refused every shape would pass having stored
642- // nothing, which is the vacuous reading of "may refuse".
641+ // "May refuse" needs a floor, or a driver that refused everything would pass
642+ // having stored nothing. The floor is `unicode` specifically rather than a
643+ // count: refusing `empty` is documented validation, and refusing `large` is
644+ // a defensible size limit, but refusing ordinary UTF-8 text is a broken
645+ // driver — and unicode is the case where mangling actually shows, since
646+ // truncation and re-encoding are invisible on ASCII.
643647 assert ! (
644- accepted > 0 ,
645- "{who}: refused every content shape — unicode, empty, large and \
646- newlines were all rejected, so this assertion proved nothing"
648+ accepted. contains( & "unicode" ) ,
649+ "{who}: refused ordinary UTF-8 content — accepted {accepted:?}. A driver \
650+ may refuse a shape, but not this one; every assertion about content \
651+ surviving a round trip rests on it."
647652 ) ;
648653 let keys: Vec < & str > = cases. iter ( ) . map ( |( k, _) | * k) . collect ( ) ;
649654 cleanup ( provider, & ns, & keys) . await ;
0 commit comments