Загрузить файлы в «tests»

This commit is contained in:
2026-03-30 02:42:36 +03:00
parent 38c2617a18
commit 39443666e7
2 changed files with 54 additions and 0 deletions

25
tests/should_panic.rs Normal file
View File

@@ -0,0 +1,25 @@
#![no_std]
#![no_main]
use amix::{exit_qemu, serial_print, serial_println, QemuExitCode};
use core::panic::PanicInfo;
#[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! {
should_fail();
serial_println!("test did not panic");
exit_qemu(QemuExitCode::Failed);
loop {}
}
fn should_fail() {
serial_print!("should_panic::should_fail...\t");
assert_eq!(0, 1);
}
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
serial_println!("[ok]");
exit_qemu(QemuExitCode::Success);
loop {}
}