PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1
 2
 3
 4// -*- rust -*-
 5type compare<T> = fn@(@T, @T) -> bool;
 6
 7fn test_generic<T>(expected: @T, eq: compare<T>) {
 8    let actual: @T = { expected };
 9    assert (eq(expected, actual));
10}
11
12fn test_box() {
13    fn compare_box(b1: @bool, b2: @bool) -> bool {
14        log(debug, *b1);
15        log(debug, *b2);
16        return *b1 == *b2;
17    }
18    test_generic::<bool>(@true, compare_box);
19}
20
21fn main() { test_box(); }