2020-04-28 01:49:40 +00:00
|
|
|
use std::path::Path;
|
|
|
|
|
2020-01-17 03:26:02 +00:00
|
|
|
#[test]
|
2020-05-30 21:51:57 +00:00
|
|
|
#[ignore]
|
2020-01-17 03:26:02 +00:00
|
|
|
fn ui_tests() {
|
|
|
|
let t = trybuild::TestCases::new();
|
|
|
|
|
|
|
|
if cfg!(feature = "postgres") {
|
|
|
|
t.compile_fail("tests/ui/postgres/*.rs");
|
2020-01-25 04:24:39 +00:00
|
|
|
|
|
|
|
// UI tests for column types that require gated features
|
2020-03-21 10:20:38 +00:00
|
|
|
if cfg!(not(feature = "chrono")) && cfg!(not(feature = "time")) {
|
2020-01-25 04:24:39 +00:00
|
|
|
t.compile_fail("tests/ui/postgres/gated/chrono.rs");
|
|
|
|
}
|
|
|
|
|
|
|
|
if cfg!(not(feature = "uuid")) {
|
|
|
|
t.compile_fail("tests/ui/postgres/gated/uuid.rs");
|
|
|
|
}
|
2020-03-20 03:26:13 +00:00
|
|
|
|
|
|
|
if cfg!(not(feature = "ipnetwork")) {
|
|
|
|
t.compile_fail("tests/ui/postgres/gated/ipnetwork.rs");
|
|
|
|
}
|
2020-01-17 03:26:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if cfg!(feature = "mysql") {
|
|
|
|
t.compile_fail("tests/ui/mysql/*.rs");
|
2020-01-25 04:24:39 +00:00
|
|
|
|
|
|
|
// UI tests for column types that require gated features
|
2020-03-21 10:20:38 +00:00
|
|
|
if cfg!(not(feature = "chrono")) && cfg!(not(feature = "time")) {
|
2020-01-25 04:24:39 +00:00
|
|
|
t.compile_fail("tests/ui/mysql/gated/chrono.rs");
|
|
|
|
}
|
2020-01-17 03:26:02 +00:00
|
|
|
}
|
|
|
|
|
2024-10-02 18:55:21 +00:00
|
|
|
if cfg!(feature = "_sqlite") {
|
2022-07-28 21:33:44 +00:00
|
|
|
if dotenvy::var("DATABASE_URL").map_or(true, |v| {
|
2020-04-28 01:49:40 +00:00
|
|
|
Path::is_relative(v.trim_start_matches("sqlite://").as_ref())
|
|
|
|
}) {
|
|
|
|
// this isn't `Trybuild`'s fault: https://github.com/dtolnay/trybuild/issues/69#issuecomment-620329526
|
|
|
|
panic!("DATABASE_URL must contain an absolute path for SQLite UI tests")
|
|
|
|
}
|
|
|
|
|
2020-03-17 03:55:19 +00:00
|
|
|
t.compile_fail("tests/ui/sqlite/*.rs");
|
|
|
|
}
|
|
|
|
|
2020-01-17 03:26:02 +00:00
|
|
|
t.compile_fail("tests/ui/*.rs");
|
|
|
|
}
|