fix(test): fix mismatched type error in MySQL type tests (#1517)

* fix new warning about trailing semicolon in expression macros

* fix(test): fix mismatched type error in MySQL type tests
This commit is contained in:
Austin Bonander 2021-10-26 13:45:46 -07:00 committed by GitHub
parent 466d3f317d
commit d25ab07f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -15,7 +15,7 @@ macro_rules! assert_attribute {
macro_rules! fail {
($t:expr, $m:expr) => {
return Err(syn::Error::new_spanned($t, $m));
return Err(syn::Error::new_spanned($t, $m))
};
}

View File

@ -197,7 +197,8 @@ macro_rules! __test_prepared_type {
#[macro_export]
macro_rules! MySql_query_for_test_prepared_type {
() => {
"SELECT {0} <=> ?, {0}, ?"
// MySQL 8.0.27 changed `<=>` to return an unsigned integer
"SELECT CAST({0} <=> ? AS SIGNED INTEGER), {0}, ?"
};
}

View File

@ -235,7 +235,8 @@ mod json_tests {
test_type!(json<JsonValue>(
MySql,
"SELECT CAST({0} AS BINARY) <=> CAST(? AS BINARY), CAST({0} AS BINARY) as _2, ? as _3",
// MySQL 8.0.27 changed `<=>` to return an unsigned integer
"SELECT CAST(CAST({0} AS BINARY) <=> CAST(? AS BINARY) AS SIGNED INTEGER), CAST({0} AS BINARY) as _2, ? as _3",
"'\"Hello, World\"'" == json!("Hello, World"),
"'\"😎\"'" == json!("😎"),
"'\"🙋‍♀️\"'" == json!("🙋‍♀️"),
@ -250,7 +251,8 @@ mod json_tests {
test_type!(json_struct<Json<Friend>>(
MySql,
"SELECT CAST({0} AS BINARY) <=> CAST(? AS BINARY), CAST({0} AS BINARY) as _2, ? as _3",
// MySQL 8.0.27 changed `<=>` to return an unsigned integer
"SELECT CAST(CAST({0} AS BINARY) <=> CAST(? AS BINARY) AS SIGNED INTEGER), CAST({0} AS BINARY) as _2, ? as _3",
"\'{\"name\":\"Joe\",\"age\":33}\'" == Json(Friend { name: "Joe".to_string(), age: 33 })
));