diff options
Diffstat (limited to 'tests/processing.rs')
-rw-r--r-- | tests/processing.rs | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/tests/processing.rs b/tests/processing.rs index 282ab65..4fdb8cb 100644 --- a/tests/processing.rs +++ b/tests/processing.rs @@ -3,41 +3,41 @@ #[test] fn split_escape_sequences() { let mut parser = vt100::Parser::new(24, 80); - let contents = parser.screen().contents(0, 0, 23, 79); + let contents = parser.screen().contents(); parser.process(b"abc"); - assert_ne!(parser.screen().contents(0, 0, 23, 79), contents); - let contents = parser.screen().contents(0, 0, 23, 79); + assert_ne!(parser.screen().contents(), contents); + let contents = parser.screen().contents(); parser.process(b"abc\x1b[12;24Hdef"); - assert_ne!(parser.screen().contents(0, 0, 23, 79), contents); - let contents = parser.screen().contents(0, 0, 23, 79); + assert_ne!(parser.screen().contents(), contents); + let contents = parser.screen().contents(); assert!(contents.contains("abc")); assert!(contents.contains("def")); assert_eq!(parser.screen().cursor_position(), (11, 26)); parser.process(b"\x1b"); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"["); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"1"); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"2"); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b";"); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"2"); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"4"); assert_eq!(parser.screen().cursor_position(), (11, 26)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"H"); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); assert_eq!( parser.screen().mouse_protocol_mode(), @@ -49,56 +49,56 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"["); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"?"); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"1"); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"0"); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"0"); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"0"); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::None ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"h"); assert_eq!( parser.screen().mouse_protocol_mode(), vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); assert_eq!(parser.screen().title(), ""); parser.process(b"\x1b"); @@ -108,7 +108,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"]"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -116,7 +116,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"0"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -124,7 +124,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b";"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -132,7 +132,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"a"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -140,7 +140,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b" "); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -148,7 +148,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"'"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -156,7 +156,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"["); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -164,7 +164,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"]"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -172,7 +172,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"_"); assert_eq!(parser.screen().title(), ""); assert_eq!( @@ -180,7 +180,7 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\x07"); assert_eq!(parser.screen().title(), "a '[]_"); assert_eq!( @@ -188,37 +188,37 @@ fn split_escape_sequences() { vt100::MouseProtocolMode::PressRelease ); assert_eq!(parser.screen().cursor_position(), (11, 23)); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); } #[test] fn split_utf8() { let mut parser = vt100::Parser::new(24, 80); - let contents = parser.screen().contents(0, 0, 23, 79); + let contents = parser.screen().contents(); parser.process(b"a"); - assert_ne!(parser.screen().contents(0, 0, 23, 79), contents); - let contents = parser.screen().contents(0, 0, 23, 79); + assert_ne!(parser.screen().contents(), contents); + let contents = parser.screen().contents(); parser.process(b"\xc3"); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\xa1"); - assert_ne!(parser.screen().contents(0, 0, 23, 79), contents); - let contents = parser.screen().contents(0, 0, 23, 79); + assert_ne!(parser.screen().contents(), contents); + let contents = parser.screen().contents(); parser.process(b"\xe3"); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\x82"); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\xad"); - assert_ne!(parser.screen().contents(0, 0, 23, 79), contents); - let contents = parser.screen().contents(0, 0, 23, 79); + assert_ne!(parser.screen().contents(), contents); + let contents = parser.screen().contents(); parser.process(b"\xf0"); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\x9f"); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\x92"); - assert_eq!(parser.screen().contents(0, 0, 23, 79), contents); + assert_eq!(parser.screen().contents(), contents); parser.process(b"\xa9"); - assert_ne!(parser.screen().contents(0, 0, 23, 79), contents); + assert_ne!(parser.screen().contents(), contents); } |