rust/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs

19 lines
302 B
Rust
Raw Normal View History

use std;
import std::list;
tag foo {
a(uint);
b(str);
}
fn check_log<T>(exp: str, v: T) {
assert exp == #fmt["%?", v];
}
fn main() {
let x = list::from_vec([a(22u), b("hi")]);
let exp = "cons(a(22), @cons(b(\"hi\"), @nil))";
assert #fmt["%?", x] == exp;
check_log(exp, x);
}