add ui tests for ipnetwork

This commit is contained in:
PoiScript 2020-03-20 11:26:13 +08:00
parent 9b6e1e089b
commit fb66cfa665
3 changed files with 44 additions and 0 deletions

View File

@ -13,6 +13,10 @@ fn ui_tests() {
if cfg!(not(feature = "uuid")) {
t.compile_fail("tests/ui/postgres/gated/uuid.rs");
}
if cfg!(not(feature = "ipnetwork")) {
t.compile_fail("tests/ui/postgres/gated/ipnetwork.rs");
}
}
if cfg!(feature = "mysql") {

View File

@ -0,0 +1,9 @@
fn main() {
let _ = sqlx::query!("select '127.0.0.1'::inet");
let _ = sqlx::query!("select '2001:4f8:3:ba::/64'::cidr");
let _ = sqlx::query!("select $1::inet", ());
let _ = sqlx::query!("select $1::cidr", ());
}

View File

@ -0,0 +1,31 @@
error: optional feature `ipnetwork` required for type INET of column #1 ("inet")
--> $DIR/ipnetwork.rs:2:13
|
2 | let _ = sqlx::query!("select '127.0.0.1'::inet");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: optional feature `ipnetwork` required for type CIDR of column #1 ("cidr")
--> $DIR/ipnetwork.rs:4:13
|
4 | let _ = sqlx::query!("select '2001:4f8:3:ba::/64'::cidr");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: optional feature `ipnetwork` required for type INET of param #1
--> $DIR/ipnetwork.rs:6:13
|
6 | let _ = sqlx::query!("select $1::inet", ());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: optional feature `ipnetwork` required for type CIDR of param #1
--> $DIR/ipnetwork.rs:8:13
|
8 | let _ = sqlx::query!("select $1::cidr", ());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)