|
@@ -628,43 +628,43 @@ mod tests {
|
|
|
|
|
|
|
|
#[test]
|
|
#[test]
|
|
|
fn parse_none_color_from_string() {
|
|
fn parse_none_color_from_string() {
|
|
|
- ["", "none", "None"].iter().for_each(|case| {
|
|
|
|
|
|
|
+ for case in &["", "none", "None"] {
|
|
|
assert_eq!(color_from_str(case), None);
|
|
assert_eq!(color_from_str(case), None);
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
#[test]
|
|
|
fn parse_default_color_from_string() {
|
|
fn parse_default_color_from_string() {
|
|
|
- ["default", "Default"].iter().for_each(|case| {
|
|
|
|
|
|
|
+ for case in &["default", "Default"] {
|
|
|
assert_eq!(color_from_str(case), Some(Color::Default));
|
|
assert_eq!(color_from_str(case), Some(Color::Default));
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
#[test]
|
|
|
fn parse_fixed_color_from_string() {
|
|
fn parse_fixed_color_from_string() {
|
|
|
- ["black", "Black"].iter().for_each(|case| {
|
|
|
|
|
|
|
+ for case in &["black", "Black"] {
|
|
|
assert_eq!(color_from_str(case), Some(Color::Black));
|
|
assert_eq!(color_from_str(case), Some(Color::Black));
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
#[test]
|
|
|
fn parse_long_hex_color_from_string() {
|
|
fn parse_long_hex_color_from_string() {
|
|
|
- ["#ff00ff", "#FF00FF"].iter().for_each(|case| {
|
|
|
|
|
|
|
+ for case in &["#ff00ff", "#FF00FF"] {
|
|
|
assert_eq!(color_from_str(case), Some(Color::Rgb(255, 0, 255)));
|
|
assert_eq!(color_from_str(case), Some(Color::Rgb(255, 0, 255)));
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
#[test]
|
|
|
fn parse_short_hex_color_from_string() {
|
|
fn parse_short_hex_color_from_string() {
|
|
|
- ["#f0f", "#F0F"].iter().for_each(|case| {
|
|
|
|
|
|
|
+ for case in ["#f0f", "#F0F"].iter() {
|
|
|
assert_eq!(color_from_str(case), Some(Color::Rgb(255, 0, 255)));
|
|
assert_eq!(color_from_str(case), Some(Color::Rgb(255, 0, 255)));
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
#[test]
|
|
|
fn parse_color_code_from_string() {
|
|
fn parse_color_code_from_string() {
|
|
|
- [("10", 10), ("01", 1)].iter().for_each(|(s, c)| {
|
|
|
|
|
|
|
+ for (s, c) in &[("10", 10), ("01", 1)] {
|
|
|
assert_eq!(color_from_str(s), Some(Color::Fixed(*c)));
|
|
assert_eq!(color_from_str(s), Some(Color::Fixed(*c)));
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|