MCPcopy Index your code
hub / github.com/endbasic/endbasic / assert_poll_is_key

Function assert_poll_is_key

sdl/src/console.rs:738–747  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

poll_keyMethod · 0.45

Tested by 1