@@ -74,6 +74,7 @@ pub mod tests {
7474 use crate :: decompression:: {
7575 decompress, decompress_all,
7676 decompressors:: { decompress_brotli, decompress_deflate} ,
77+ error:: DecompressError ,
7778 } ;
7879 use bytes:: { BufMut , BytesMut } ;
7980 use flate2:: Compression ;
@@ -135,7 +136,9 @@ pub mod tests {
135136 ContentEncoding :: Deflate => compress_deflate ( data) ,
136137 ContentEncoding :: Gzip => compress_gzip ( data) ,
137138 ContentEncoding :: Zstd | ContentEncoding :: Compress => compress_zstd ( data) ,
138- ContentEncoding :: Identity => data. to_vec ( ) ,
139+ ContentEncoding :: Identity | ContentEncoding :: Unknown ( _) | ContentEncoding :: Chunked => {
140+ data. to_vec ( )
141+ }
139142 _ => panic ! ( ) ,
140143 } ;
141144 let mut buf = BytesMut :: new ( ) ;
@@ -181,9 +184,51 @@ pub mod tests {
181184 assert_eq ! ( result. as_ref( ) , INPUT ) ;
182185 }
183186
187+ #[ test]
188+ fn test_basic_chunked ( ) {
189+ let result = test_decompress ( INPUT , ContentEncoding :: Chunked ) ;
190+ assert_eq ! ( result. as_ref( ) , b"" ) ;
191+ }
192+
193+ #[ test]
194+ fn test_basic_unknown ( ) {
195+ let mut buf = BytesMut :: new ( ) ;
196+ let mut writer = buf. writer ( ) ;
197+ let result = decompress (
198+ INPUT ,
199+ & mut writer,
200+ ContentEncoding :: Unknown ( "unknown" . to_string ( ) ) ,
201+ ) ;
202+ if let Err ( DecompressError :: Unknown ( e) ) = result {
203+ assert_eq ! ( e, "unknown" ) ;
204+ } else {
205+ panic ! ( ) ;
206+ }
207+ }
208+
184209 // Combined tests
185210 #[ test]
186- fn test_decompress_all ( ) {
211+ fn test_decompress_all_single_header ( ) {
212+ let input = all_compressed_data ( ) ;
213+ let mut buf = BytesMut :: new ( ) ;
214+ let mut writer = ( & mut buf) . writer ( ) ;
215+ let einfo_list = vec ! [ EncodingInfo :: new(
216+ 0 ,
217+ vec![
218+ ContentEncoding :: Brotli ,
219+ ContentEncoding :: Deflate ,
220+ ContentEncoding :: Gzip ,
221+ ContentEncoding :: Zstd ,
222+ ContentEncoding :: Identity ,
223+ ] ,
224+ ) ] ;
225+
226+ let result = decompress_all ( & input, & mut writer, & einfo_list) . unwrap ( ) ;
227+ assert_eq ! ( result, INPUT ) ;
228+ }
229+
230+ #[ test]
231+ fn test_decompress_all_multi_header ( ) {
187232 let input = all_compressed_data ( ) ;
188233 let mut buf = BytesMut :: new ( ) ;
189234 let mut writer = ( & mut buf) . writer ( ) ;
0 commit comments