()
| 22 | |
| 23 | #[test] |
| 24 | fn test_encode_ready_for_query() { |
| 25 | let mut codec = PostgresCodec::new(); |
| 26 | let mut buf = BytesMut::new(); |
| 27 | |
| 28 | let msg = BackendMessage::ReadyForQuery { status: TransactionStatus::Idle }; |
| 29 | codec.encode(msg, &mut buf).unwrap(); |
| 30 | |
| 31 | assert_eq!(buf[0], b'Z'); |
| 32 | assert_eq!(&buf[1..5], &5i32.to_be_bytes()); // Fixed length |
| 33 | assert_eq!(buf[5], b'I'); // Idle status |
| 34 | } |
| 35 | |
| 36 | #[test] |
| 37 | fn test_encode_error_response() { |