Skip to content

Commit 28f00b2

Browse files
committed
test(xtask/html_snapshot): cover color_hex mapping every ANSI-16 named color to its exact hex value, exercising all sixteen Color enum arms from Black through White including the dim and Light* bright variants
1 parent ccf0365 commit 28f00b2

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎xtask/src/html_snapshot.rs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,4 +537,24 @@ mod tests {
537537
assert_eq!(color_hex(Color::Indexed(9)), "currentColor");
538538
assert_eq!(color_hex(Color::Reset), "currentColor");
539539
}
540+
541+
#[test]
542+
fn color_hex_maps_every_ansi16_named_color() {
543+
assert_eq!(color_hex(Color::Black), "#000000");
544+
assert_eq!(color_hex(Color::Red), "#aa0000");
545+
assert_eq!(color_hex(Color::Green), "#00aa00");
546+
assert_eq!(color_hex(Color::Yellow), "#aa5500");
547+
assert_eq!(color_hex(Color::Blue), "#0000aa");
548+
assert_eq!(color_hex(Color::Magenta), "#aa00aa");
549+
assert_eq!(color_hex(Color::Cyan), "#00aaaa");
550+
assert_eq!(color_hex(Color::Gray), "#aaaaaa");
551+
assert_eq!(color_hex(Color::DarkGray), "#555555");
552+
assert_eq!(color_hex(Color::LightRed), "#ff5555");
553+
assert_eq!(color_hex(Color::LightGreen), "#55ff55");
554+
assert_eq!(color_hex(Color::LightYellow), "#ffff55");
555+
assert_eq!(color_hex(Color::LightBlue), "#5555ff");
556+
assert_eq!(color_hex(Color::LightMagenta), "#ff55ff");
557+
assert_eq!(color_hex(Color::LightCyan), "#55ffff");
558+
assert_eq!(color_hex(Color::White), "#ffffff");
559+
}
540560
}

0 commit comments

Comments
 (0)