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

Function assert_poll_is_none

sdl/src/console.rs:727–734  ·  view source on GitHub ↗

Ensure the console doesn't return a key press for a brief period of time. Given that this is based on timing, the console could still report an event long after we finished polling. This is fine: if the console works well, we shouldn't receive spurious events here, which means that under normal conditions, this is not flaky. However, if there is a bug somewhere, this is not guaranteed to catch i

(console: &mut SdlConsole)

Source from the content-addressed store, hash-verified

725 /// spurious events here, which means that under normal conditions, this is not flaky.
726 /// However, if there is a bug somewhere, this is not guaranteed to catch it reliably.
727 fn assert_poll_is_none(console: &mut SdlConsole) {
728 let mut millis = 10;
729 while millis > 0 {
730 assert_eq!(None, block_on(console.poll_key()).unwrap());
731 thread::sleep(Duration::from_millis(1));
732 millis -= 1;
733 }
734 }
735
736 /// Waits for `console.poll_key` to return `exp_key` and fails the test if it returns any
737 /// other key.

Callers 1

Calls

no outgoing calls

Tested by 1