diff --git a/tests/test_ascii_macros.rs b/tests/test_ascii_macros.rs new file mode 100644 index 0000000..5b69238 --- /dev/null +++ b/tests/test_ascii_macros.rs @@ -0,0 +1,22 @@ +#[cfg(test)] +mod tests { + use libmake::macro_ascii; + + #[test] + fn test_macro_ascii_success() { + let art = macro_ascii!("Hi"); + assert_eq!(art, " _ _ _ \n | | | | (_)\n | |_| | | |\n | _ | | |\n |_| |_| |_|\n \n"); + } + + #[test] + #[should_panic(expected = "Failed to generate ASCII art: Failed to convert text to ASCII art")] + fn test_macro_ascii_empty_input() { + let _art = macro_ascii!(""); + } + + #[test] + #[should_panic(expected = "Failed to generate ASCII art: Failed to convert text to ASCII art")] + fn test_macro_ascii_invalid_input() { + let _art = macro_ascii!("🦀"); + } +} diff --git a/tests/data/test_yaml.rs b/tests/test_yaml.rs similarity index 87% rename from tests/data/test_yaml.rs rename to tests/test_yaml.rs index 8deec6e..b14aa76 100644 --- a/tests/data/test_yaml.rs +++ b/tests/test_yaml.rs @@ -1,24 +1,15 @@ #[cfg(test)] mod tests { use libmake::generators::yaml::generate_from_yaml; - use std::io::{self, Write}; + use std::io::Write; use std::fs::File; use tempfile::tempdir; #[test] fn test_generate_from_yaml_success() { - let dir = tempdir().unwrap(); let file_path = "./tests/data/mylibrary.yaml"; - - let yaml_data = r#" - output: test_output_dir - "#; - - let mut file = File::create(&file_path).unwrap(); - file.write_all(yaml_data.as_bytes()).unwrap(); - - let result = generate_from_yaml(file_path.to_str().unwrap()); - assert!(result.is_ok()); + generate_from_yaml(file_path).unwrap(); + assert_eq!(true, true); } #[test]