|
1 | | -#[test] |
2 | | -fn ui_tests() { |
3 | | - let t = trybuild::TestCases::new(); |
| 1 | +use std::path::Path; |
4 | 2 |
|
5 | | - t.compile_fail("tests/ui/compound-index-missing-field.rs"); |
6 | | - t.compile_fail("tests/ui/compound-index-missing-config.rs"); |
7 | | - t.compile_fail("tests/ui/compound-index-too-many-fields.rs"); |
8 | | - t.compile_fail("tests/ui/index-unsupported.rs"); |
9 | | - t.compile_fail("tests/ui/compound-index-unsupported.rs"); |
10 | | - t.compile_fail("tests/ui/using-pk-instead-of-pk-sk.rs"); |
11 | | - t.compile_fail("tests/ui/invalid-field-name.rs"); |
12 | | - t.compile_fail("tests/ui/pk-field-no-partition.rs"); |
13 | | - t.compile_fail("tests/ui/pk-field-wrong-partition.rs"); |
| 3 | +macro_rules! run_tests { |
| 4 | + (fail => {$($f:expr),*}, pass => {$($p:expr),*}) => { |
| 5 | + #[test] |
| 6 | + fn ui_tests() { |
| 7 | + let t = trybuild::TestCases::new(); |
| 8 | + let base = Path::new("tests"); |
14 | 9 |
|
15 | | - t.pass("tests/ui/pk-field-on-struct.rs"); |
16 | | - t.pass("tests/ui/pass.rs"); |
| 10 | + $( |
| 11 | + t.compile_fail(base.join($f)); |
| 12 | + )* |
| 13 | + |
| 14 | + $( |
| 15 | + t.pass(base.join($p)); |
| 16 | + )* |
| 17 | + } |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +run_tests! { |
| 22 | + fail => { |
| 23 | + "./ui/compound-index-missing-config.rs", |
| 24 | + "./ui/compound-index-missing-field.rs", |
| 25 | + "./ui/compound-index-too-many-fields.rs", |
| 26 | + "./ui/compound-index-unsupported.rs", |
| 27 | + "./ui/index-unsupported.rs", |
| 28 | + "./ui/invalid-field-name.rs", |
| 29 | + "./ui/pk-field-no-partition.rs", |
| 30 | + "./ui/pk-field-wrong-partition.rs", |
| 31 | + "./ui/sk-field-no-sort.rs", |
| 32 | + "./ui/sk-field-wrong-sort.rs", |
| 33 | + "./ui/using-pk-instead-of-pk-sk.rs" |
| 34 | + }, |
| 35 | + |
| 36 | + pass => { |
| 37 | + "./ui/pass.rs", |
| 38 | + "./ui/pk-field-on-struct.rs" |
| 39 | + } |
17 | 40 | } |
0 commit comments