Skip to content

Commit 05b0f57

Browse files
atezetspenserblack
authored andcommitted
Differentiate between ansi_term style and colored style due to deprecation of reverse
1 parent 981cfe4 commit 05b0f57

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tests/ansi_term_compat.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ mod compat_colors {
3535
}
3636

3737
macro_rules! test_simple_style {
38-
($string:expr, $style:ident) => {
38+
($string:expr, $colored_style:ident, $ansi_term_style:ident) => {
3939
#[test]
40-
fn $style() {
41-
let s = format!("{} {}", $string, stringify!($style));
40+
fn $colored_style() {
41+
let s = format!("{} {}", $string, stringify!($colored_style));
4242
assert_eq!(
43-
s.$style().to_string(),
44-
ansi_term::Style::new().$style().paint(s).to_string()
43+
s.$colored_style().to_string(),
44+
ansi_term::Style::new()
45+
.$ansi_term_style()
46+
.paint(s)
47+
.to_string()
4548
)
4649
}
4750
};
@@ -53,13 +56,13 @@ mod compat_styles {
5356
use super::colored;
5457
use super::colored::*;
5558

56-
test_simple_style!("test string", bold);
57-
test_simple_style!("test string", dimmed);
58-
test_simple_style!("test string", italic);
59-
test_simple_style!("test string", underline);
60-
test_simple_style!("test string", blink);
61-
test_simple_style!("test string", reverse);
62-
test_simple_style!("test string", hidden);
59+
test_simple_style!("test string", bold, bold);
60+
test_simple_style!("test string", dimmed, dimmed);
61+
test_simple_style!("test string", italic, italic);
62+
test_simple_style!("test string", underline, underline);
63+
test_simple_style!("test string", blink, blink);
64+
test_simple_style!("test string", reversed, reverse);
65+
test_simple_style!("test string", hidden, hidden);
6366
}
6467

6568
macro_rules! test_simple_bgcolor {

0 commit comments

Comments
 (0)