20 lines
357 B
Rust
20 lines
357 B
Rust
// test4.rs
|
|
// This test covers the sections:
|
|
// - Modules
|
|
// - Macros
|
|
|
|
// Write a macro that passes the test! No hints this time, you can do it!
|
|
|
|
#[macro_export]
|
|
macro_rules! my_macro {
|
|
($x:expr) => {{
|
|
format!("Hello {}", $x)
|
|
}};
|
|
}
|
|
|
|
fn main() {
|
|
if my_macro!("world!") != "Hello world!" {
|
|
panic!("Oh no! Wrong output!");
|
|
}
|
|
}
|