/src/test/run-pass/expr-block-generic-box1.rs
http://github.com/jruderman/rust · Rust · 21 lines · 14 code · 6 blank · 1 comment · 1 complexity · 206fed76a0c0c1be3faea158a3c025be MD5 · raw file
- // -*- rust -*-
- type compare<T> = fn@(@T, @T) -> bool;
- fn test_generic<T>(expected: @T, eq: compare<T>) {
- let actual: @T = { expected };
- assert (eq(expected, actual));
- }
- fn test_box() {
- fn compare_box(b1: @bool, b2: @bool) -> bool {
- log(debug, *b1);
- log(debug, *b2);
- return *b1 == *b2;
- }
- test_generic::<bool>(@true, compare_box);
- }
- fn main() { test_box(); }