Skip to content

Commit

Permalink
Fix test failures with --features no-color (#75)
Browse files Browse the repository at this point in the history
Bug: #75
  • Loading branch information
kentfredric committed May 26, 2020
1 parent 5dedbe9 commit 07425ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Expand Up @@ -640,41 +640,47 @@ mod tests {
assert_eq!("", "".clear().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_simple_fg_blue() {
let blue = "\x1B[34m";

assert_eq!(blue, "".blue().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_simple_bg_blue() {
let on_blue = "\x1B[44m";

assert_eq!(on_blue, "".on_blue().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_blue_on_blue() {
let blue_on_blue = "\x1B[44;34m";

assert_eq!(blue_on_blue, "".blue().on_blue().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_simple_fg_bright_blue() {
let blue = "\x1B[94m";

assert_eq!(blue, "".bright_blue().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_simple_bg_bright_blue() {
let on_blue = "\x1B[104m";

assert_eq!(on_blue, "".on_bright_blue().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_bright_blue_on_bright_blue() {
let blue_on_blue = "\x1B[104;94m";
Expand All @@ -685,20 +691,23 @@ mod tests {
);
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_simple_bold() {
let bold = "\x1B[1m";

assert_eq!(bold, "".bold().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_blue_bold() {
let blue_bold = "\x1B[1;34m";

assert_eq!(blue_bold, "".blue().bold().compute_style());
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn compute_style_blue_bold_on_blue() {
let blue_bold_on_blue = "\x1B[1;44;34m";
Expand Down Expand Up @@ -732,6 +741,7 @@ mod tests {
assert_eq!(expected, output);
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn escape_reset_sequence_spec_should_replace_inner_reset_sequence_with_current_style() {
let input = format!("start {} end", String::from("hello world !").red());
Expand All @@ -745,6 +755,7 @@ mod tests {
assert_eq!(expected, output);
}

#[cfg_attr(feature = "no-color", ignore)]
#[test]
fn escape_reset_sequence_spec_should_replace_multiple_inner_reset_sequences_with_current_style()
{
Expand Down
1 change: 1 addition & 0 deletions tests/ansi_term_compat.rs
@@ -1,3 +1,4 @@
#![cfg(not(feature = "no-color"))]
#![allow(unused_imports)]

extern crate ansi_term;
Expand Down

0 comments on commit 07425ea

Please sign in to comment.