()
| 46 | |
| 47 | #[test] |
| 48 | fn test_observer() { |
| 49 | let mut observer = Observer::default(); |
| 50 | observer.add_listener(Box::new(|t| { |
| 51 | assert_eq!(*t, 42); |
| 52 | COUNT.with(|count| { |
| 53 | *count.borrow_mut() += 1; |
| 54 | }); |
| 55 | })); |
| 56 | observer.add_listener(Box::new(|t| { |
| 57 | assert_eq!(*t, 42); |
| 58 | COUNT.with(|count| { |
| 59 | *count.borrow_mut() += 1; |
| 60 | }); |
| 61 | })); |
| 62 | |
| 63 | observer.notify(&42); |
| 64 | |
| 65 | COUNT.with(|count| { |
| 66 | assert_eq!(*count.borrow(), 2); |
| 67 | }); |
| 68 | } |
| 69 | |
| 70 | #[test] |
| 71 | fn test_observer_debug() { |
nothing calls this directly
no test coverage detected