test: Add a test for generic objects. r=test-only

This commit is contained in:
Patrick Walton 2012-11-29 11:18:36 -08:00
parent 9e1c9be16f
commit 976e1ced00

View File

@ -0,0 +1,20 @@
trait Foo<T> {
fn get() -> T;
}
struct S {
x: int
}
impl S : Foo<int> {
fn get() -> int {
self.x
}
}
fn main() {
let x = @S { x: 1 };
let y = x as @Foo<int>;
assert y.get() == 1;
}