@@ -177,154 +177,3 @@ where
177177 }
178178 }
179179}
180-
181- /*
182- #[cfg(test)]
183- mod tests {
184-
185- use crate::{
186- DecompressTrait,
187- state::DecodeState,
188- tests::{INPUT, single_compression},
189- };
190-
191-
192- // CE only
193- fn assert_decode_state_ce_only_single(content_encoding: ContentEncoding) {
194- let body = single_compression(&content_encoding);
195- let headers = format!(
196- "Host: example.com\r\n\
197- Content-Type: text/html; charset=utf-8\r\n\
198- Content-Encoding: {}\r\n\
199- Content-Length: {}\r\n\r\n",
200- content_encoding.as_ref(),
201- body.len()
202- );
203- let mut tm = TestMessage::build(
204- headers.as_bytes().into(),
205- Body::Raw(body.as_slice().into()),
206- None,
207- );
208-
209- let mut buf = BytesMut::new();
210- let mut state = DecodeState::init(&mut tm, &mut buf);
211- state = state.try_next().unwrap();
212- assert!(matches!(state, DecodeState::ContentEncoding(_, _)));
213-
214- state = state.try_next().unwrap();
215- assert!(matches!(state, DecodeState::UpdateContentLength(_)));
216-
217- state = state.try_next().unwrap();
218- assert!(matches!(state, DecodeState::End));
219-
220- let result = tm.into_bytes();
221- let verify = "Host: example.com\r\n\
222- Content-Type: text/html; charset=utf-8\r\n\
223- Content-Length: 11\r\n\r\n\
224- hello world";
225- assert_eq!(result, verify);
226- }
227-
228- #[test]
229- fn test_decode_state_ce_only_brotli() {
230- assert_decode_state_ce_only_single(ContentEncoding::Brotli);
231- }
232-
233- #[test]
234- fn test_decode_state_ce_only_compress() {
235- assert_decode_state_ce_only_single(ContentEncoding::Compress);
236- }
237-
238- #[test]
239- fn test_decode_state_ce_only_deflate() {
240- assert_decode_state_ce_only_single(ContentEncoding::Deflate);
241- }
242-
243- #[test]
244- fn test_decode_state_ce_only_gzip() {
245- assert_decode_state_ce_only_single(ContentEncoding::Gzip);
246- }
247-
248- #[test]
249- fn test_decode_state_ce_only_identity() {
250- assert_decode_state_ce_only_single(ContentEncoding::Identity);
251- }
252-
253- #[test]
254- fn test_decode_state_ce_only_zstd() {
255- assert_decode_state_ce_only_single(ContentEncoding::Zstd);
256- }
257-
258- // TE only
259- fn assert_decode_state_te_only_single(content_encoding: ContentEncoding) {
260- let body = single_compression(&content_encoding);
261- let headers = format!(
262- "Host: example.com\r\n\
263- Content-Type: text/html; charset=utf-8\r\n\
264- Transfer-Encoding: {}\r\n\
265- Content-Length: {}\r\n\r\n",
266- content_encoding.as_ref(),
267- body.len()
268- );
269- let mut tm = TestMessage::build(
270- headers.as_bytes().into(),
271- Body::Raw(body.as_slice().into()),
272- None,
273- );
274-
275- let mut buf = BytesMut::new();
276- let mut state = DecodeState::init(&mut tm, &mut buf);
277- state = state.try_next().unwrap();
278- assert!(matches!(state, DecodeState::TransferEncoding(_, _)));
279-
280- state = state.try_next().unwrap();
281- assert!(matches!(state, DecodeState::UpdateContentLength(_)));
282-
283- state = state.try_next().unwrap();
284- assert!(matches!(state, DecodeState::End));
285-
286- let result = tm.into_bytes();
287- let verify = "Host: example.com\r\n\
288- Content-Type: text/html; charset=utf-8\r\n\
289- Content-Length: 11\r\n\r\n\
290- hello world";
291- assert_eq!(result, verify);
292- }
293-
294- #[test]
295- fn test_decode_state_te_only_brotli() {
296- assert_decode_state_te_only_single(ContentEncoding::Brotli);
297- }
298-
299- #[test]
300- fn test_decode_state_te_only_chunked() {
301- ()
302- }
303-
304- #[test]
305- fn test_decode_state_te_only_compress() {
306- assert_decode_state_te_only_single(ContentEncoding::Compress);
307- }
308-
309- #[test]
310- fn test_decode_state_te_only_deflate() {
311- assert_decode_state_te_only_single(ContentEncoding::Deflate);
312- }
313-
314- #[test]
315- fn test_decode_state_te_only_gzip() {
316- assert_decode_state_te_only_single(ContentEncoding::Gzip);
317- }
318-
319- #[test]
320- fn test_decode_state_te_only_identity() {
321- assert_decode_state_te_only_single(ContentEncoding::Identity);
322- }
323-
324- #[test]
325- fn test_decode_state_te_only_zstd() {
326- assert_decode_state_te_only_single(ContentEncoding::Zstd);
327- }
328-
329- }
330- */
0 commit comments