pgsql: add test for parameter status parser

Since we've done some changes to how the parameters are parsed, add one
more test case to check that.

Bug #5579
pull/8118/head
Juliana Fajardini 3 years ago committed by Victor Julien
parent c4fbd78770
commit a654ef50de

@ -2073,7 +2073,69 @@ mod tests {
}
}
// TODO keep adding more messages
//A series of response messages from the backend:
// R · S ·application_name
// S ·client_encoding UTF8 S ·DateStyle ISO, MDY
// S &default_transaction_read_only off S ·in_hot_standby off
// S ·integer_datetimes on S ·IntervalStyle postgres
// S ·is_superuser off S ·server_encoding UTF8
// S ·server_version 14.5 S "session_authorization ctfpost
// S #standard_conforming_strings on S ·TimeZone Europe/Paris
// K ···O··Z ·I
let buf = &[
0x52, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x53, 0x00, 0x00, 0x00, 0x16, 0x61, 0x70,
0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00,
0x53, 0x00, 0x00, 0x00, 0x19, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x5f, 0x65, 0x6e, 0x63, 0x6f,
0x64, 0x69, 0x6e, 0x67, 0x00, 0x55, 0x54, 0x46,
0x38, 0x00, 0x53, 0x00, 0x00, 0x00, 0x17, 0x44,
0x61, 0x74, 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65,
0x00, 0x49, 0x53, 0x4f, 0x2c, 0x20, 0x4d, 0x44,
0x59, 0x00, 0x53, 0x00, 0x00, 0x00, 0x26, 0x64,
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x74,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f,
0x6f, 0x6e, 0x6c, 0x79, 0x00, 0x6f, 0x66, 0x66,
0x00, 0x53, 0x00, 0x00, 0x00, 0x17, 0x69, 0x6e,
0x5f, 0x68, 0x6f, 0x74, 0x5f, 0x73, 0x74, 0x61,
0x6e, 0x64, 0x62, 0x79, 0x00, 0x6f, 0x66, 0x66,
0x00, 0x53, 0x00, 0x00, 0x00, 0x19, 0x69, 0x6e,
0x74, 0x65, 0x67, 0x65, 0x72, 0x5f, 0x64, 0x61,
0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x00,
0x6f, 0x6e, 0x00, 0x53, 0x00, 0x00, 0x00, 0x1b,
0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c,
0x53, 0x74, 0x79, 0x6c, 0x65, 0x00, 0x70, 0x6f,
0x73, 0x74, 0x67, 0x72, 0x65, 0x73, 0x00, 0x53,
0x00, 0x00, 0x00, 0x15, 0x69, 0x73, 0x5f, 0x73,
0x75, 0x70, 0x65, 0x72, 0x75, 0x73, 0x65, 0x72,
0x00, 0x6f, 0x66, 0x66, 0x00, 0x53, 0x00, 0x00,
0x00, 0x19, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e,
0x67, 0x00, 0x55, 0x54, 0x46, 0x38, 0x00, 0x53,
0x00, 0x00, 0x00, 0x18, 0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x00, 0x31, 0x34, 0x2e, 0x35, 0x00,
0x53, 0x00, 0x00, 0x00, 0x22, 0x73, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74,
0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x00, 0x63, 0x74, 0x66, 0x70, 0x6f,
0x73, 0x74, 0x00, 0x53, 0x00, 0x00, 0x00, 0x23,
0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64,
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x72, 0x6d,
0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x72, 0x69,
0x6e, 0x67, 0x73, 0x00, 0x6f, 0x6e, 0x00, 0x53,
0x00, 0x00, 0x00, 0x1a, 0x54, 0x69, 0x6d, 0x65,
0x5a, 0x6f, 0x6e, 0x65, 0x00, 0x45, 0x75, 0x72,
0x6f, 0x70, 0x65, 0x2f, 0x50, 0x61, 0x72, 0x69,
0x73, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x00, 0x0b, 0x8d, 0xcf, 0x4f, 0xb6, 0xcf, 0x5a,
0x00, 0x00, 0x00, 0x05, 0x49
];
let result = pgsql_parse_response(buf);
assert!(result.is_ok());
}
#[test]

Loading…
Cancel
Save