Debian Codegraph @

tests/ui-tests.rs

raw symbols SCIP
1 use std::path::Path;
2
3 #[test]
4 #[ignore]
5 fn ui_tests() {
6 let t = trybuild::TestCases::new();
7
8 if cfg!(feature = "postgres") {
9 t.compile_fail("tests/ui/postgres/*.rs");
10
11 // UI tests for column types that require gated features
12 if cfg!(not(feature = "chrono")) && cfg!(not(feature = "time")) {
13 t.compile_fail("tests/ui/postgres/gated/chrono.rs");
14 }
15
16 if cfg!(not(feature = "uuid")) {
17 t.compile_fail("tests/ui/postgres/gated/uuid.rs");
18 }
19
20 if cfg!(not(feature = "ipnetwork")) {
21 t.compile_fail("tests/ui/postgres/gated/ipnetwork.rs");
22 }
23 }
24
25 if cfg!(feature = "mysql") {
26 t.compile_fail("tests/ui/mysql/*.rs");
27
28 // UI tests for column types that require gated features
29 if cfg!(not(feature = "chrono")) && cfg!(not(feature = "time")) {
30 t.compile_fail("tests/ui/mysql/gated/chrono.rs");
31 }
32 }
33
34 if cfg!(feature = "_sqlite") {
35 if dotenvy::var("DATABASE_URL").map_or(true, |v| {
36 Path::is_relative(v.trim_start_matches("sqlite://").as_ref())
37 }) {
38 // this isn't `Trybuild`'s fault: https://github.com/dtolnay/trybuild/issues/69#issuecomment-620329526
39 panic!("DATABASE_URL must contain an absolute path for SQLite UI tests")
40 }
41
42 t.compile_fail("tests/ui/sqlite/*.rs");
43 }
44
45 t.compile_fail("tests/ui/*.rs");
46 }