Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test for mssql LoginAck #1890

Merged
merged 1 commit into from Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions sqlx-core/src/mssql/protocol/login_ack.rs
Expand Up @@ -4,6 +4,7 @@ use crate::error::Error;
use crate::mssql::io::MssqlBufExt;
use crate::mssql::protocol::pre_login::Version;

#[allow(dead_code)]
Copy link
Contributor Author

@walf443 walf443 Jun 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for CI warnings reduction.

sqlx-core/src/mssql/protocol/login_ack.rs#L9
field is never read: `interface`

#[derive(Debug)]
pub(crate) struct LoginAck {
pub(crate) interface: u8,
Expand Down Expand Up @@ -37,3 +38,23 @@ impl LoginAck {
})
}
}

#[test]
fn test_get() {
#[rustfmt::skip]
let mut buf = Bytes::from_static(&[
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
]);

let login_ack = LoginAck::get(&mut buf).unwrap();

assert_eq!(login_ack.interface, 1);
assert_eq!(login_ack.tds_version, 67108980);

assert_eq!(login_ack.program_version.major, 15);
assert_eq!(login_ack.program_version.minor, 0);
assert_eq!(login_ack.program_version.build, 4223);
assert_eq!(login_ack.program_version.sub_build, 0);

assert_eq!(login_ack.program_name, "Microsoft S3L Server\0\0");
}