Skip to content

Commit a322ef4

Browse files
committed
test: Add test for basic color styles
1 parent d0c6ff5 commit a322ef4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/styled_text.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ impl StyledText {
5151
}
5252

5353
pub fn paint(&mut self) -> String {
54-
println!("{:?}", self.start_styles);
5554
let mut default_paint_type = PaintType::FG;
5655

5756
let start_codes_list: Vec<String> = self.start_styles
@@ -183,9 +182,16 @@ mod test {
183182
use super::*;
184183

185184
#[test]
186-
fn test_paint_type() {
187-
let txt = txt("Siavash").bright_blue().fg().red().bg().paint();
188-
assert_eq!(true, false);
185+
fn white_fg_black_bg() {
186+
let raw_text = "I'm So Happy";
187+
let styled_text = txt(raw_text).white().bg().black().fg().paint();
188+
assert_eq!(styled_text, "\x1b[47m\x1b[30mI'm So Happy\x1b[0m");
189+
}
190+
191+
fn blue_fg_bright_cyan_bg() {
192+
let raw_text = "Silence is power";
193+
let styled_text = txt(raw_text).blue().fg().bright_cyan().bg().paint();
194+
assert_eq!(styled_text, "\x1b[34m\x1b[106mSilence is power\x1b[0m");
189195
}
190196

191197
#[test]

0 commit comments

Comments
 (0)