Add bold flag to tests, add tests for disabled bold characters
@@ -264,36 +264,46 @@ mod test {
#[test]
fn truncate() {
let colors_shim = Vec::new();
- assert_eq!(Tokens("").render(&colors_shim, 0, 0), "\u{1b}[1;37m\u{1b}[0m");
+ assert_eq!(Tokens("").render(&colors_shim, 0, 0, true), "\u{1b}[1;37m\u{1b}[0m");
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 0),
+ Tokens(" ").render(&colors_shim, 0, 0, true),
"\u{1b}[1;37m\u{1b}[0m"
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 5),
+ Tokens(" ").render(&colors_shim, 0, 5, true),
"\u{1b}[1;37m \u{1b}[0m"
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 1, 5),
+ Tokens(" ").render(&colors_shim, 1, 5, true),
"\u{1b}[1;37m \u{1b}[0m"
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 3, 5),
+ Tokens(" ").render(&colors_shim, 3, 5, true),
"\u{1b}[1;37m \u{1b}[0m"
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 4),
+ Tokens(" ").render(&colors_shim, 0, 4, true),
"\u{1b}[1;37m \u{1b}[0m"
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 3),
+ Tokens(" ").render(&colors_shim, 0, 3, true),
"\u{1b}[1;37m \u{1b}[0m"
);
assert_eq!(
- Tokens(" {1} {5} {9} a").render(&colors_shim, 4, 10),
+ Tokens(" {1} {5} {9} a").render(&colors_shim, 4, 10, true),
"\u{1b}[1;37m\u{1b}[0m\u{1b}[1;37m\u{1b}[0m\u{1b}[1;37m \u{1b}[0m\u{1b}[1;37m a\u{1b}[0m "
);
+
+ // Tests for bold disabled
+ assert_eq!(
+ Tokens(" ").render(&colors_shim, 0, 0, false),
+ "\u{1b}[37m\u{1b}[0m"
+ );
+ assert_eq!(
+ Tokens(" ").render(&colors_shim, 0, 5, false),
+ "\u{1b}[37m \u{1b}[0m"
+ );
}
}
