Updated tests for tokenizer.
@@ -257,37 +257,39 @@ 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("").truncate(0, 0).collect::<Vec<_>>(),
+ Tokens("").collect::<Vec<_>>()
+ );
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 0),
- "\u{1b}[1;37m\u{1b}[0m"
+ Tokens(" ").truncate(0, 0).collect::<Vec<_>>(),
+ Tokens("").collect::<Vec<_>>()
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 5),
- "\u{1b}[1;37m \u{1b}[0m"
+ Tokens(" ").truncate(0, 5).collect::<Vec<_>>(),
+ Tokens(" ").collect::<Vec<_>>()
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 1, 5),
- "\u{1b}[1;37m \u{1b}[0m"
+ Tokens(" ").truncate(1, 5).collect::<Vec<_>>(),
+ Tokens(" ").collect::<Vec<_>>()
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 3, 5),
- "\u{1b}[1;37m \u{1b}[0m"
+ Tokens(" ").truncate(3, 5).collect::<Vec<_>>(),
+ Tokens(" ").collect::<Vec<_>>()
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 4),
- "\u{1b}[1;37m \u{1b}[0m"
+ Tokens(" ").truncate(0, 4).collect::<Vec<_>>(),
+ Tokens(" ").collect::<Vec<_>>()
);
assert_eq!(
- Tokens(" ").render(&colors_shim, 0, 3),
- "\u{1b}[1;37m \u{1b}[0m"
+ Tokens(" ").truncate(0, 3).collect::<Vec<_>>(),
+ Tokens(" ").collect::<Vec<_>>()
);
assert_eq!(
- Tokens(" {1} {5} {9} a").render(&colors_shim, 4, 10),
- "\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 "
+ Tokens(" {1} {5} {9} a").truncate(4, 10).collect::<Vec<_>>(),
+ Tokens("{1}{5} {9} a").collect::<Vec<_>>()
);
}
}
