update and fix error in tests
@@ -315,7 +315,7 @@ fn ssl_ca_tests() {
);
let conn_opts = ConnectionOptions::parse(db_url.as_str()).unwrap();
let cstring = |s| CString::new(s).unwrap();
- assert_eq!(None, conn_opts.host);
+ assert_eq!(Some("localhost"), conn_opts.host);
assert_eq!(None, conn_opts.port);
assert_eq!(cstring(username), conn_opts.user);
assert_eq!(cstring(password), conn_opts.password.unwrap());
@@ -323,6 +323,19 @@ fn ssl_ca_tests() {
CString::new(ssl_ca).unwrap(),
conn_opts.ssl_ca.unwrap()
);
+
+ let url_with_unix_str_and_ssl_ca = format!(
+ "mysql://{}:{}@localhost?unix_socket=/var/run/mysqld.sock&ssl_ca={}",
+ username, password, ssl_ca
+ );
+
+ let conn_opts2 = ConnectionOptions::parse(url_with_unix_str_and_ssl_ca.as_str()).unwrap();
+ assert_eq!(None, conn_opts2.host);
+ assert_eq!(None, conn_opts2.port);
+ assert_eq!(
+ CString::new(ssl_ca).unwrap(),
+ conn_opts2.ssl_ca.unwrap()
+ );
}
#[test]
