Skip to content

Commit 884cd71

Browse files
committed
Auto merge of #741 - ecstatic-morse:test-macro-omit-program, r=jackh726
Allow `test` invocations to elide empty `program` declarations This is a bit silly, but there are quite a few of these in `tests/subtype.rs`.
2 parents 977b0a5 + 164edc3 commit 884cd71

File tree

11 files changed

+5
-54
lines changed

11 files changed

+5
-54
lines changed

tests/test/constants.rs

-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ fn generic_impl() {
108108
#[test]
109109
fn placeholders_eq() {
110110
test! {
111-
program {}
112-
113111
goal {
114112
forall<const C, const D> {
115113
C = D

tests/test/misc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,6 @@ fn endless_loop() {
807807
#[test]
808808
fn env_bound_vars() {
809809
test! {
810-
program {}
811810
goal {
812811
exists<'a> {
813812
if (WellFormed(&'a ())) {

tests/test/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ macro_rules! test {
5555
let (program, goals) = parse_test_data!(program $program $($goals)*);
5656
solve_goal(program, goals, false)
5757
}};
58+
59+
// If `program` is omitted, default to an empty one.
60+
($($goals:tt)*) => {
61+
test!(program {} $($goals)*)
62+
};
5863
}
5964

6065
macro_rules! parse_test_data {

tests/test/never.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use super::*;
33
#[test]
44
fn never_is_well_formed() {
55
test! {
6-
program { }
76
goal {
87
WellFormed(!)
98
} yields {

tests/test/numerics.rs

-6
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ fn float_ambiguity() {
129129
#[test]
130130
fn integer_and_float_are_specialized_ty_kinds() {
131131
test! {
132-
program {}
133-
134132
goal {
135133
exists<T, int N> {
136134
T = N, N = usize
@@ -154,8 +152,6 @@ fn integer_and_float_are_specialized_ty_kinds() {
154152
#[test]
155153
fn general_ty_kind_becomes_specific() {
156154
test! {
157-
program {}
158-
159155
goal {
160156
exists<T, int N> {
161157
T = N, T = char
@@ -178,8 +174,6 @@ fn general_ty_kind_becomes_specific() {
178174
#[test]
179175
fn integers_are_not_floats() {
180176
test! {
181-
program {}
182-
183177
goal {
184178
exists<int I, float F> {
185179
I = F

tests/test/refs.rs

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ fn immut_refs_are_sized() {
4444
#[test]
4545
fn mut_refs_are_well_formed() {
4646
test! {
47-
program { }
48-
4947
goal {
5048
forall<'a, T> { WellFormed(&'a mut T) }
5149
} yields {

tests/test/scalars.rs

-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ fn scalar_trait_impl() {
116116
#[test]
117117
fn scalars_are_well_formed() {
118118
test! {
119-
program { }
120-
121119
goal { WellFormed(i8) } yields { "Unique" }
122120
goal { WellFormed(i16) } yields { "Unique" }
123121
goal { WellFormed(i32) } yields { "Unique" }

tests/test/string.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ fn str_trait_impl() {
1515
#[test]
1616
fn str_is_well_formed() {
1717
test! {
18-
program {}
1918
goal { WellFormed(str) } yields { "Unique" }
2019
}
2120
}

tests/test/subtype.rs

-34
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ fn struct_lifetime_variance() {
5555
#[test]
5656
fn ref_lifetime_variance() {
5757
test! {
58-
program {
59-
}
60-
6158
goal {
6259
forall<'a, 'b> {
6360
Subtype(&'a u32, &'b u32)
@@ -74,9 +71,6 @@ fn ref_lifetime_variance() {
7471
#[test]
7572
fn fn_lifetime_variance_args() {
7673
test! {
77-
program {
78-
}
79-
8074
goal {
8175
for<'a, 'b> fn(&'a u32, &'b u32) = for<'a> fn(&'a u32, &'a u32)
8276
} yields[SolverChoice::recursive_default()] {
@@ -100,9 +94,6 @@ fn fn_lifetime_variance_args() {
10094
#[test]
10195
fn fn_lifetime_variance_with_return_type() {
10296
test! {
103-
program {
104-
}
105-
10697
goal {
10798
Subtype(for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32, for<'a> fn(&'a u32, &'a u32) -> &'a u32)
10899
} yields {
@@ -151,8 +142,6 @@ fn generalize() {
151142
#[test]
152143
fn multi_lifetime() {
153144
test! {
154-
program {}
155-
156145
goal {
157146
forall<'a, 'b> {
158147
exists<U> {
@@ -183,8 +172,6 @@ fn multi_lifetime() {
183172
#[test]
184173
fn multi_lifetime_inverted() {
185174
test! {
186-
program {}
187-
188175
goal {
189176
forall<'a, 'b> {
190177
exists<U> {
@@ -347,9 +334,6 @@ fn multi_lifetime_invariant_struct() {
347334
#[test]
348335
fn multi_lifetime_slice() {
349336
test! {
350-
program {
351-
}
352-
353337
goal {
354338
forall<'a, 'b> {
355339
exists<U> {
@@ -385,9 +369,6 @@ fn multi_lifetime_slice() {
385369
#[test]
386370
fn multi_lifetime_tuple() {
387371
test! {
388-
program {
389-
}
390-
391372
goal {
392373
forall<'a, 'b> {
393374
exists<U> {
@@ -423,9 +404,6 @@ fn multi_lifetime_tuple() {
423404
#[test]
424405
fn multi_lifetime_array() {
425406
test! {
426-
program {
427-
}
428-
429407
goal {
430408
forall<'a, 'b> {
431409
exists<U> {
@@ -543,9 +521,6 @@ fn generalize_invariant_struct() {
543521
#[test]
544522
fn generalize_slice() {
545523
test! {
546-
program {
547-
}
548-
549524
goal {
550525
forall<'a, 'b> {
551526
exists<U> {
@@ -581,9 +556,6 @@ fn generalize_slice() {
581556
#[test]
582557
fn generalize_tuple() {
583558
test! {
584-
program {
585-
}
586-
587559
goal {
588560
forall<'a, 'b> {
589561
exists<U> {
@@ -619,9 +591,6 @@ fn generalize_tuple() {
619591
#[test]
620592
fn generalize_2tuple() {
621593
test! {
622-
program {
623-
}
624-
625594
goal {
626595
forall<'a, 'b, 'c, 'd> {
627596
exists<U> {
@@ -659,9 +628,6 @@ fn generalize_2tuple() {
659628
#[test]
660629
fn generalize_array() {
661630
test! {
662-
program {
663-
}
664-
665631
goal {
666632
forall<'a, 'b> {
667633
exists<U> {

tests/test/unify.rs

-3
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ fn forall_equality() {
180180
#[test]
181181
fn unify_quantified_lifetimes() {
182182
test! {
183-
program {
184-
}
185-
186183
// Check that `'a` (here, `'^0.0`) is not unified
187184
// with `'!1_0`, because they belong to incompatible
188185
// universes.

tests/test/wf_goals.rs

-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ fn drop_compatible() {
111111
#[test]
112112
fn placeholder_wf() {
113113
test! {
114-
program { }
115-
116114
goal {
117115
forall<T> { WellFormed(T) }
118116
} yields {

0 commit comments

Comments
 (0)