Skip to content

Commit b5682bf

Browse files
authored
Merge branch 'master' into refactor-modules
2 parents 57c7f26 + e9d3111 commit b5682bf

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Diff for: src/ascii_art.rs

+36
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,40 @@ mod test {
254254
assert_eq!(Tokens(" a;lksjf;a").leading_spaces(), 5);
255255
assert_eq!(Tokens(" {1} {5} {9} a").leading_spaces(), 6);
256256
}
257+
258+
#[test]
259+
fn truncate() {
260+
let colors_shim = Vec::new();
261+
assert_eq!(Tokens("").render(&colors_shim, 0, 0), "\u{1b}[1;37m\u{1b}[0m");
262+
263+
assert_eq!(
264+
Tokens(" ").render(&colors_shim, 0, 0),
265+
"\u{1b}[1;37m\u{1b}[0m"
266+
);
267+
assert_eq!(
268+
Tokens(" ").render(&colors_shim, 0, 5),
269+
"\u{1b}[1;37m \u{1b}[0m"
270+
);
271+
assert_eq!(
272+
Tokens(" ").render(&colors_shim, 1, 5),
273+
"\u{1b}[1;37m \u{1b}[0m"
274+
);
275+
assert_eq!(
276+
Tokens(" ").render(&colors_shim, 3, 5),
277+
"\u{1b}[1;37m \u{1b}[0m"
278+
);
279+
assert_eq!(
280+
Tokens(" ").render(&colors_shim, 0, 4),
281+
"\u{1b}[1;37m \u{1b}[0m"
282+
);
283+
assert_eq!(
284+
Tokens(" ").render(&colors_shim, 0, 3),
285+
"\u{1b}[1;37m \u{1b}[0m"
286+
);
287+
288+
assert_eq!(
289+
Tokens(" {1} {5} {9} a").render(&colors_shim, 4, 10),
290+
"\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 "
291+
);
292+
}
257293
}

0 commit comments

Comments
 (0)