aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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