Add the proper tests

This commit is contained in:
Ding Xiang Fei 2020-07-31 18:04:13 +08:00
parent 4631579b00
commit c5114549d7
No known key found for this signature in database
GPG Key ID: 3CD748647EEF6359

View File

@ -12,12 +12,23 @@ struct A<T: 'static>(&'static T);
struct B<T: 'static + ?Sized> {
x: &'static T,
}
static STR: &'static [u8] = b"hi";
static C: A<B<B<[u8]>>> = {
A(&B {
x: &B { x: b"hi" as &[u8] },
x: &B { x: STR },
})
};
pub struct Slice(&'static [i32]);
static CONTENT: i32 = 42;
pub static CONTENT_MAP: Slice = Slice(&[CONTENT]);
pub static FOO: (i32, i32) = (42, 43);
pub static CONTENT_MAP2: Slice = Slice(&[FOO.0]);
fn main() {
assert_eq!(b"hi", C.0.x.x);
assert_eq!(&[42], CONTENT_MAP.0);
assert_eq!(&[42], CONTENT_MAP2.0);
}