MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_encode_error_response

Function test_encode_error_response

tests/protocol_test.rs:37–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36#[test]
37fn test_encode_error_response() {
38 let mut codec = PostgresCodec::new();
39 let mut buf = BytesMut::new();
40
41 let err = ErrorResponse::new(
42 "ERROR".to_string(),
43 "42P01".to_string(),
44 "relation \"users\" does not exist".to_string(),
45 );
46
47 let msg = BackendMessage::ErrorResponse(Box::new(err));
48 codec.encode(msg, &mut buf).unwrap();
49
50 assert_eq!(buf[0], b'E');
51 // Should contain severity, code, and message fields
52 assert!(buf.len() > 20);
53}
54
55#[test]
56fn test_decode_startup_message() {

Callers

nothing calls this directly

Calls 2

ErrorResponseClass · 0.85
encodeMethod · 0.80

Tested by

no test coverage detected