test: Added integration tests for the ValidateTheme macro

This commit is contained in:
2025-03-06 16:00:50 -07:00
parent b012fc29e4
commit 709f6ca6ca
7 changed files with 112 additions and 12 deletions
@@ -8,7 +8,7 @@ fn test_derive_enum_display_style() {
}
#[derive(EnumDisplayStyle)]
pub enum TestEnum {
enum TestEnum {
#[display_style(name = "Testing 123")]
Test,
Ignored,
@@ -0,0 +1,35 @@
use validate_theme_derive::ValidateTheme;
#[test]
fn test_validate_theme_derive() {
let theme = Theme {
name: "test".to_string(),
good: Some(Style {
color: "Green".to_owned(),
}),
bad: Some(Style {
color: "Red".to_owned(),
}),
ugly: Some(Style {
color: "Magenta".to_owned(),
}),
};
theme.validate();
}
#[allow(dead_code)]
struct Style {
color: String,
}
#[allow(dead_code)]
#[derive(ValidateTheme)]
struct Theme {
pub name: String,
#[validate]
pub good: Option<Style>,
#[validate]
pub bad: Option<Style>,
pub ugly: Option<Style>,
}