/src/test/run-pass/expr-alt-generic-box1.rs
http://github.com/jruderman/rust · Rust · 17 lines · 10 code · 6 blank · 1 comment · 2 complexity · 38537d47e7592addd3bc19a9b4f2775b MD5 · raw file
- // -*- rust -*-
- type compare<T> = fn@(@T, @T) -> bool;
- fn test_generic<T>(expected: @T, eq: compare<T>) {
- let actual: @T = match check true { true => { expected } };
- assert (eq(expected, actual));
- }
- fn test_box() {
- fn compare_box(b1: @bool, b2: @bool) -> bool { return *b1 == *b2; }
- test_generic::<bool>(@true, compare_box);
- }
- fn main() { test_box(); }