1 // run-pass
2 #![allow(unused_braces)]
3
test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool4 fn test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool {
5 let actual: Box<T> = { expected.clone() };
6 assert!(eq(expected, actual));
7 }
8
test_box()9 fn test_box() {
10 fn compare_box(b1: Box<bool>, b2: Box<bool>) -> bool {
11 println!("{}", *b1);
12 println!("{}", *b2);
13 return *b1 == *b2;
14 }
15 test_generic::<bool, _>(Box::new(true), compare_box);
16 }
17
main()18 pub fn main() { test_box(); }
19