From 41a688ea8b6a5788ee983977334f6cc783a7b009 Mon Sep 17 00:00:00 2001 From: Gerrit Viljoen Date: Sun, 17 May 2020 12:17:58 +0200 Subject: [PATCH] save game --- src/test.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/test.rs b/src/test.rs index a286e6e..3c1876c 100644 --- a/src/test.rs +++ b/src/test.rs @@ -523,13 +523,28 @@ fn mixed_types() { } #[test] -fn color_codes() { +fn color_codes_zero() { let config = AsciiTable::default(); let input = vec![vec![ - "Hello".color(Color::Blue).bg_color(Color::Yellow).bold() + "\u{1b}[0mHello\u{1b}[0m" ]]; + let expected = "┌───────┐\n\ + │ \u{1b}[0mHello\u{1b}[0m │\n\ + └───────┘\n"; + + assert_eq!(expected, config.format(input)); +} + +#[test] +fn color_codes() { + let config = AsciiTable::default(); + let input = vec![ + vec!["Hello".color(Color::Blue).bg_color(Color::Yellow).bold()], + vec!["Hello".gradient(Color::Red)] + ]; let expected = "┌───────┐\n\ │ \u{1b}[38;5;4m\u{1b}[48;5;3;1mHello\u{1b}[0m │\n\ + │ \u{1b}[38;2;255;0;0mH\u{1b}[38;2;255;6;0me\u{1b}[38;2;255;13;0ml\u{1b}[38;2;255;19;0ml\u{1b}[38;2;255;26;0mo\u{1b}[0m │\n\ └───────┘\n"; assert_eq!(expected, config.format(input));