aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatasha Moongrave <natasha@256phi.eu>2026-02-17 20:46:22 +0100
committerNatasha Moongrave <natasha@256phi.eu>2026-02-17 20:46:22 +0100
commitccf07c7bbd08ee33232b493672fdd7ba5f1db5f3 (patch)
tree4cac0c3fa157e986900d8ff343d02179162b1b0d
parent6f823cf7d714106c7981e3df6bd3169274c5db0f (diff)
updated main.rs to use the current tests and println! working tree
-rw-r--r--StrixKernel/src/main.rs29
1 files changed, 22 insertions, 7 deletions
diff --git a/StrixKernel/src/main.rs b/StrixKernel/src/main.rs
index f91134b..a037096 100644
--- a/StrixKernel/src/main.rs
+++ b/StrixKernel/src/main.rs
@@ -1,24 +1,39 @@
// main.rs
-#![no_std] // don't link the Rust standard library
-#![no_main] // disable all Rust-level entry points
-
-mod vga_buffer;
+#![no_std]
+#![no_main]
+#![feature(custom_test_frameworks)]
+#![test_runner(strix_os::test_runner)]
+#![reexport_test_harness_main = "test_main"]
+use strix_os::println;
use core::panic::PanicInfo;
-static HELLO: &[u8] = b"Hello World!";
-
#[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! {
println!("Hello World{}", "!");
- panic!("This is a test panic message");
+
+ #[cfg(test)]
+ test_main();
+
loop {}
}
/// This function is called on panic.
+#[cfg(not(test))]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
loop {}
}
+
+#[cfg(test)]
+#[panic_handler]
+fn panic(info: &PanicInfo) -> ! {
+ strix_os::test_panic_handler(info)
+}
+
+#[test_case]
+fn trivial_assertion() {
+ assert_eq!(1, 1);
+} \ No newline at end of file