//! transport 模块(chunked 解码)的集成测试。 //! Integration tests for the transport module (chunked decoding). use focus_transport::transport::decode_chunked; #[test] fn decodes_simple_chunked_body() { // 两个分块:"Hello" 与 " World",随后是终止分块。 // Two chunks: "Hello" and " World", then terminating chunk. let body = b"5\r\nHello\r\n6\r\n World\r\n0\r\n\r\n"; let decoded = decode_chunked(body).unwrap(); assert_eq!(decoded, b"Hello World"); } #[test] fn decodes_chunk_with_extension() { let body = b"5;name=value\r\nHello\r\n0\r\n\r\n"; let decoded = decode_chunked(body).unwrap(); assert_eq!(decoded, b"Hello"); } #[test] fn decodes_single_chunk() { let body = b"3\r\nabc\r\n0\r\n\r\n"; assert_eq!(decode_chunked(body).unwrap(), b"abc"); }