2011-09-23 16:58:06 -05:00
|
|
|
|
|
|
|
|
|
|
|
// -*- rust -*-
|
2011-10-18 17:07:40 -05:00
|
|
|
type compare<T> = fn@(~T, ~T) -> bool;
|
2011-09-23 16:58:06 -05:00
|
|
|
|
2011-11-18 05:39:20 -06:00
|
|
|
fn test_generic<copy T>(expected: ~T, eq: compare<T>) {
|
2011-09-23 16:58:06 -05:00
|
|
|
let actual: ~T = { expected };
|
|
|
|
assert (eq(expected, actual));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_box() {
|
|
|
|
fn compare_box(b1: ~bool, b2: ~bool) -> bool {
|
2011-12-22 16:42:52 -06:00
|
|
|
log_full(core::debug, *b1);
|
|
|
|
log_full(core::debug, *b2);
|
2011-09-23 16:58:06 -05:00
|
|
|
ret *b1 == *b2;
|
|
|
|
}
|
|
|
|
let eq = bind compare_box(_, _);
|
|
|
|
test_generic::<bool>(~true, eq);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { test_box(); }
|