Skip to content

Commit 5e3e1b5

Browse files
committed
Add tests ensuring refs are WF/Sized/Copy/Clone
1 parent 94a52b7 commit 5e3e1b5

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

tests/test/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ mod impls;
314314
mod misc;
315315
mod negation;
316316
mod projection;
317+
mod refs;
317318
mod scalars;
318319
mod tuples;
319320
mod unify;

tests/test/refs.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
use super::*;
2+
3+
#[test]
4+
fn refs_are_well_formed() {
5+
test! {
6+
program { }
7+
8+
goal {
9+
forall<'a, T> { WellFormed(&'a T) }
10+
} yields {
11+
"Unique; substitution [], lifetime constraints []"
12+
}
13+
}
14+
}
15+
16+
#[test]
17+
fn refs_are_sized() {
18+
test! {
19+
program {
20+
#[lang(sized)]
21+
trait Sized { }
22+
}
23+
24+
goal {
25+
forall<'a, T> { &'a T: Sized }
26+
} yields {
27+
"Unique; substitution [], lifetime constraints []"
28+
}
29+
}
30+
}
31+
32+
#[test]
33+
fn refs_are_copy() {
34+
test! {
35+
program {
36+
#[lang(copy)]
37+
trait Copy { }
38+
}
39+
40+
goal {
41+
forall<'a, T> { &'a T: Copy }
42+
} yields {
43+
"Unique; substitution [], lifetime constraints []"
44+
}
45+
}
46+
}
47+
48+
#[test]
49+
fn refs_are_clone() {
50+
test! {
51+
program {
52+
#[lang(clone)]
53+
trait Clone { }
54+
}
55+
56+
goal {
57+
forall<'a, T> { &'a T: Clone }
58+
} yields {
59+
"Unique; substitution [], lifetime constraints []"
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)