aboutsummaryrefslogtreecommitdiffstats
path: root/tests/window_contents.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-05 10:26:19 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-05 10:26:19 -0500
commit665238f5318bee40f254fe43aa158e61bdd25392 (patch)
tree19d2c6828a6263ec3b2b9ee44363774ecdaaca5c /tests/window_contents.rs
parentb24d69d51b3567f75630bb1b3a6875dac6e1c647 (diff)
downloadvt100-rust-665238f5318bee40f254fe43aa158e61bdd25392.tar.gz
vt100-rust-665238f5318bee40f254fe43aa158e61bdd25392.zip
contents_formatted should return a Vec<u8>
the overall terminal escape sequence byte stream is not necessarily utf8-safe, even if individual cell contents are
Diffstat (limited to 'tests/window_contents.rs')
-rw-r--r--tests/window_contents.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/window_contents.rs b/tests/window_contents.rs
index 898351e..5fe0cda 100644
--- a/tests/window_contents.rs
+++ b/tests/window_contents.rs
@@ -2,7 +2,7 @@
fn formatted() {
let mut parser = vt100::Parser::new(24, 80);
compare_formatted(&parser);
- assert_eq!(parser.screen().contents_formatted(0, 0, 23, 79), "");
+ assert_eq!(parser.screen().contents_formatted(0, 0, 23, 79), b"");
parser.process(b"foobar");
compare_formatted(&parser);
@@ -10,7 +10,7 @@ fn formatted() {
assert!(!parser.screen().cell(0, 3).unwrap().bold());
assert!(!parser.screen().cell(0, 4).unwrap().bold());
assert!(!parser.screen().cell(0, 5).unwrap().bold());
- assert_eq!(parser.screen().contents_formatted(0, 0, 23, 79), "foobar");
+ assert_eq!(parser.screen().contents_formatted(0, 0, 23, 79), b"foobar");
parser.process(b"\x1b[1;4H\x1b[1;7m\x1b[33mb");
compare_formatted(&parser);
@@ -20,7 +20,7 @@ fn formatted() {
assert!(!parser.screen().cell(0, 5).unwrap().bold());
assert_eq!(
parser.screen().contents_formatted(0, 0, 23, 79),
- "foo\x1b[33;1;7mb\x1b[mar"
+ b"foo\x1b[33;1;7mb\x1b[mar"
);
parser.process(b"\x1b[1;5H\x1b[22;42ma");
@@ -31,27 +31,27 @@ fn formatted() {
assert!(!parser.screen().cell(0, 5).unwrap().bold());
assert_eq!(
parser.screen().contents_formatted(0, 0, 23, 79),
- "foo\x1b[33;1;7mb\x1b[42;22ma\x1b[mr"
+ b"foo\x1b[33;1;7mb\x1b[42;22ma\x1b[mr"
);
parser.process(b"\x1b[1;6H\x1b[35mr\r\nquux");
compare_formatted(&parser);
assert_eq!(
parser.screen().contents_formatted(0, 0, 23, 79),
- "foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\nquux"
+ &b"foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\nquux"[..]
);
parser.process(b"\x1b[2;1H\x1b[45mquux");
compare_formatted(&parser);
assert_eq!(
parser.screen().contents_formatted(0, 0, 23, 79),
- "foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\n\x1b[45mquux"
+ &b"foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\n\x1b[45mquux"[..]
);
parser
.process(b"\x1b[2;2H\x1b[38;2;123;213;231mu\x1b[38;5;254mu\x1b[39mx");
compare_formatted(&parser);
- assert_eq!(parser.screen().contents_formatted(0, 0 ,23, 79), "foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\n\x1b[45mq\x1b[38;2;123;213;231mu\x1b[38;5;254mu\x1b[39mx");
+ assert_eq!(parser.screen().contents_formatted(0, 0 ,23, 79), &b"foo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\n\x1b[45mq\x1b[38;2;123;213;231mu\x1b[38;5;254mu\x1b[39mx"[..]);
}
fn compare_formatted(parser: &vt100::Parser) {
@@ -59,7 +59,7 @@ fn compare_formatted(parser: &vt100::Parser) {
let contents =
parser.screen().contents_formatted(0, 0, rows - 1, cols - 1);
let mut parser2 = vt100::Parser::new(rows, cols);
- parser2.process(contents.as_bytes());
+ parser2.process(&contents);
compare_cells(parser, &parser2);
}