diff --git a/src/kernel/thread.rs b/src/kernel/thread.rs index 1b8b41d..b07058b 100644 --- a/src/kernel/thread.rs +++ b/src/kernel/thread.rs @@ -103,10 +103,26 @@ fn start_thread_execution() { #[cfg(test)] mod test { - use super::Thread; + use super::{Thread, ThreadContext}; - fn get_new_thread() -> Thread { - Thread::new("test_thread") + macro_rules! get_new_thread { + () => { Thread::new("test_thread") }; + ($a:literal) => { + Thread::new(&$a.to_string()) + }; + } + + #[test] + fn test_macro() { + let t = get_new_thread!("hello"); + assert_eq!(t.get_name(), "hello"); + let t = get_new_thread!(1); + assert_eq!(t.get_name(), "1"); + } + + #[test] + fn check_init() { + let t = get_new_thread!(); } } \ No newline at end of file