Waits for `console.poll_key` to return `exp_key` and fails the test if it returns any other key.
(console: &mut SdlConsole, exp_key: Key)
| 736 | /// Waits for `console.poll_key` to return `exp_key` and fails the test if it returns any |
| 737 | /// other key. |
| 738 | fn assert_poll_is_key(console: &mut SdlConsole, exp_key: Key) { |
| 739 | loop { |
| 740 | match block_on(console.poll_key()).unwrap() { |
| 741 | Some(key) if key == exp_key => break, |
| 742 | Some(key) => panic!("Unexpected key {:?}", key), |
| 743 | None => (), |
| 744 | } |
| 745 | thread::sleep(Duration::from_millis(1)); |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | assert_poll_is_none(test.console()); |
| 750 |