@@ -521,8 +521,8 @@ mod tests {
521521 let mut output = Vec :: new ( ) ;
522522 pipeline
523523 . process ( Cursor :: new ( html. as_bytes ( ) ) , & mut output)
524- . unwrap ( ) ;
525- let processed = String :: from_utf8 ( output) . unwrap ( ) ;
524+ . expect ( "pipeline should process HTML" ) ;
525+ let processed = String :: from_utf8 ( output) . expect ( "output should be valid UTF-8" ) ;
526526
527527 assert ! ( processed. contains( "keep-me" ) ) ;
528528 assert ! ( !processed. contains( "remove-me" ) ) ;
@@ -554,9 +554,9 @@ mod tests {
554554 let mut output = Vec :: new ( ) ;
555555 pipeline
556556 . process ( Cursor :: new ( html. as_bytes ( ) ) , & mut output)
557- . unwrap ( ) ;
557+ . expect ( "pipeline should process HTML" ) ;
558558
559- let result = String :: from_utf8 ( output) . unwrap ( ) ;
559+ let result = String :: from_utf8 ( output) . expect ( "output should be valid UTF-8" ) ;
560560 assert ! ( result. contains( r#"href="https://test.example.com/page""# ) ) ;
561561 assert ! ( result. contains( r#"href="//test.example.com/proto""# ) ) ;
562562 assert ! ( result. contains( r#"href="test.example.com/bare""# ) ) ;
@@ -615,8 +615,8 @@ mod tests {
615615 let mut output = Vec :: new ( ) ;
616616 pipeline
617617 . process ( Cursor :: new ( html. as_bytes ( ) ) , & mut output)
618- . unwrap ( ) ;
619- let result = String :: from_utf8 ( output) . unwrap ( ) ;
618+ . expect ( "pipeline should process HTML" ) ;
619+ let result = String :: from_utf8 ( output) . expect ( "output should be valid UTF-8" ) ;
620620
621621 // Assertions - only URL attribute replacements are expected
622622 // Check URL replacements (not all occurrences will be replaced since
@@ -717,8 +717,10 @@ mod tests {
717717
718718 // Compress
719719 let mut encoder = GzEncoder :: new ( Vec :: new ( ) , GzCompression :: default ( ) ) ;
720- encoder. write_all ( html. as_bytes ( ) ) . unwrap ( ) ;
721- let compressed_input = encoder. finish ( ) . unwrap ( ) ;
720+ encoder
721+ . write_all ( html. as_bytes ( ) )
722+ . expect ( "should write to gzip encoder" ) ;
723+ let compressed_input = encoder. finish ( ) . expect ( "should finish gzip encoding" ) ;
722724
723725 println ! ( "Compressed input size: {} bytes" , compressed_input. len( ) ) ;
724726
@@ -738,7 +740,7 @@ mod tests {
738740 let mut compressed_output = Vec :: new ( ) ;
739741 pipeline
740742 . process ( Cursor :: new ( & compressed_input) , & mut compressed_output)
741- . unwrap ( ) ;
743+ . expect ( "pipeline should process gzipped HTML" ) ;
742744
743745 // Ensure we produced output
744746 assert ! (
@@ -749,7 +751,9 @@ mod tests {
749751 // Decompress and verify
750752 let mut decoder = GzDecoder :: new ( & compressed_output[ ..] ) ;
751753 let mut decompressed = String :: new ( ) ;
752- decoder. read_to_string ( & mut decompressed) . unwrap ( ) ;
754+ decoder
755+ . read_to_string ( & mut decompressed)
756+ . expect ( "should decompress gzip output" ) ;
753757
754758 let remaining_urls = decompressed. matches ( "www.test-publisher.com" ) . count ( ) ;
755759 let replaced_urls = decompressed
0 commit comments