diff options
Diffstat (limited to 'kernel/src/lib.rs')
-rw-r--r-- | kernel/src/lib.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 8d967ad..d5a3e9e 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -17,19 +17,12 @@ use io::{qemu, serial, vga_text}; pub fn test_runner(tests: &[&dyn Fn(&mut OStream)]) { let mut stdout = OStream::new(); stdout.clear(); - write!(&mut stdout, "running {} tests\n", tests.len()); + write!(&mut stdout, "running {} tests\n", tests.len()).unwrap(); for test in tests { test(&mut stdout) } } -#[test_case] -fn test01(stdout: &mut OStream) { - write!(stdout, "running test01 . . . OK"); - write!(serial::SerialStream::new(), "running test01 . . . OK\n"); - assert_eq!(0, 1); -} - #[no_mangle] pub extern "C" fn _start() -> ! { if cfg!(test) { @@ -40,8 +33,7 @@ pub extern "C" fn _start() -> ! { let mut stdout = OStream::new(); stdout.clear(); - - write!(&mut stdout, "hello world!"); + panic!("panic!"); core::iter::successors(Some(0), |n| Some(n + 1)) .for_each(|n| write!(&mut stdout, "hello world {}!", n).unwrap()); @@ -69,14 +61,14 @@ pub extern "C" fn panic_handler(_info: &core::panic::PanicInfo) -> ! { let text = _info .payload() .downcast_ref::<&str>() - .unwrap_or(&"no panic informations are obtainable"); + .unwrap_or(&"no panic information is obtainable"); stderr.set_state(vga_text::CharState::from_colors( vga_text::Color::Cyan, vga_text::Color::Red, )); stderr.print_centered(text.as_bytes()); if cfg!(test) { - write!(serial::SerialStream::new(), "Testing failed\n"); + write!(serial::SerialStream::new(), "Testing failed\n").unwrap(); qemu::exit_qemu(qemu::QemuExitCode::Failed); } loop {} |