Skip to content

Commit 185c57d

Browse files
authored
added test for LoginAck (#1890)
1 parent 4e9bfb0 commit 185c57d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

sqlx-core/src/mssql/protocol/login_ack.rs

+21
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::error::Error;
44
use crate::mssql::io::MssqlBufExt;
55
use crate::mssql::protocol::pre_login::Version;
66

7+
#[allow(dead_code)]
78
#[derive(Debug)]
89
pub(crate) struct LoginAck {
910
pub(crate) interface: u8,
@@ -37,3 +38,23 @@ impl LoginAck {
3738
})
3839
}
3940
}
41+
42+
#[test]
43+
fn test_get() {
44+
#[rustfmt::skip]
45+
let mut buf = Bytes::from_static(&[
46+
0x36, 0, 1, 0x74, 0, 0, 4, 0x16, 0x4d, 0, 0x69, 0, 0x63, 0, 0x72, 0, 0x6f, 0, 0x73, 0, 0x6f, 0, 0x66, 0, 0x74, 0, 0x20, 0, 0x53, 0, 51, 0, 0x4c, 0, 0x20, 0, 0x53, 0, 0x65, 0, 0x72, 0, 0x76, 0, 0x65, 0, 0x72, 0, 0, 0, 0, 0, 0xf, 0, 0x10, 0x7f, 0xe3, 0x13, 0, 4, 4, 0x34, 0, 0x30, 0, 0x39, 0, 0x36, 0, 4, 0x34, 0, 0x30, 0, 0x39, 0, 0x36, 0, 0xfd, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
47+
]);
48+
49+
let login_ack = LoginAck::get(&mut buf).unwrap();
50+
51+
assert_eq!(login_ack.interface, 1);
52+
assert_eq!(login_ack.tds_version, 67108980);
53+
54+
assert_eq!(login_ack.program_version.major, 15);
55+
assert_eq!(login_ack.program_version.minor, 0);
56+
assert_eq!(login_ack.program_version.build, 4223);
57+
assert_eq!(login_ack.program_version.sub_build, 0);
58+
59+
assert_eq!(login_ack.program_name, "Microsoft S3L Server\0\0");
60+
}

0 commit comments

Comments
 (0)