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

Function test_paging_interrupt

std/src/console/pager.rs:331–352  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

329
330 #[tokio::test]
331 async fn test_paging_interrupt() {
332 let mut cb = MockConsole::default();
333 cb.set_size_chars(CharsXY { x: 60, y: 3 });
334 cb.set_interactive(true);
335 cb.add_input_keys(&[Key::Escape]);
336
337 let mut pager = Pager::new(&mut cb, None).unwrap();
338 pager.print("line 1").await.unwrap();
339 match pager.print("line 2").await {
340 Ok(()) => panic!("Should have been interrupted"),
341 Err(e) => assert_eq!(io::ErrorKind::Interrupted, e.kind()),
342 }
343
344 assert_eq!(
345 [
346 CapturedOut::Print("line 1".to_owned()),
347 CapturedOut::Print("line 2".to_owned()),
348 CapturedOut::Print(MORE_MESSAGE_WIDE.to_owned()),
349 ],
350 cb.captured_out()
351 );
352 }
353}

Callers

nothing calls this directly

Calls 4

set_interactiveMethod · 0.80
add_input_keysMethod · 0.80
set_size_charsMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected