From 8b971ffab6079a706ac925f5917f987932b55c07 Mon Sep 17 00:00:00 2001 From: Stig Johan Berggren Date: Tue, 25 Feb 2020 14:13:10 +0100 Subject: [PATCH 1/2] Enable test for exercise test4 --- exercises/test4.rs | 11 ++++++++--- info.toml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/exercises/test4.rs b/exercises/test4.rs index c543a64..f3875cf 100644 --- a/exercises/test4.rs +++ b/exercises/test4.rs @@ -7,8 +7,13 @@ // I AM NOT DONE -fn main() { - if my_macro!("world!") != "Hello world!" { - panic!("Oh no! Wrong output!"); +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_my_macro() { + assert_eq!(my_macro!("world!"), "Hello world!"); } } + diff --git a/info.toml b/info.toml index 2e6b0b4..4b89029 100644 --- a/info.toml +++ b/info.toml @@ -369,7 +369,7 @@ The way macros are written, it wants to see something between each [[exercises]] name = "test4" path = "exercises/test4.rs" -mode = "compile" +mode = "test" hint = "No hints this time ;)" # MOVE SEMANTICS From a45486f2d05ce1081fab5709f629ae765368509b Mon Sep 17 00:00:00 2001 From: Stig Johan Berggren Date: Tue, 25 Feb 2020 14:18:31 +0100 Subject: [PATCH 2/2] Add a second test case --- exercises/test4.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercises/test4.rs b/exercises/test4.rs index f3875cf..ad1f6ac 100644 --- a/exercises/test4.rs +++ b/exercises/test4.rs @@ -12,8 +12,12 @@ mod tests { use super::*; #[test] - fn test_my_macro() { + fn test_my_macro_world() { assert_eq!(my_macro!("world!"), "Hello world!"); } -} + #[test] + fn test_my_macro_goodbye() { + assert_eq!(my_macro!("goodbye!"), "Hello goodbye!"); + } +}