diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-12 15:37:31 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-12 15:40:48 -0500 |
commit | e85e57949df612e22463c06fc31fb0b7957ea3c7 (patch) | |
tree | 02543dc13dd61c70be68a71a4f43aea4a5a9f30c /tests | |
parent | 89654c576119ba958a57e9c557d974b657d7c986 (diff) | |
download | vt100-rust-e85e57949df612e22463c06fc31fb0b7957ea3c7.tar.gz vt100-rust-e85e57949df612e22463c06fc31fb0b7957ea3c7.zip |
split formatted calculations into multiple methods
different applications want to be able to apply different things, so
this gives more control
Diffstat (limited to 'tests')
-rw-r--r-- | tests/control.rs | 13 | ||||
-rw-r--r-- | tests/escape.rs | 23 | ||||
-rw-r--r-- | tests/mode.rs | 228 | ||||
-rw-r--r-- | tests/osc.rs | 77 |
4 files changed, 332 insertions, 9 deletions
diff --git a/tests/control.rs b/tests/control.rs index 8372cea..e0dc276 100644 --- a/tests/control.rs +++ b/tests/control.rs @@ -9,27 +9,32 @@ fn bel() { parser.process(b"\x07"); assert_eq!(parser.screen().audible_bell_count(), 1); assert_eq!(parser.screen().audible_bell_count(), 1); - assert_eq!(parser.screen().contents_diff(&screen), b"\x07"); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!(parser.screen().bells_diff(&screen), b"\x07"); let screen = parser.screen().clone(); parser.process(b"\x07"); assert_eq!(parser.screen().audible_bell_count(), 2); - assert_eq!(parser.screen().contents_diff(&screen), b"\x07"); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!(parser.screen().bells_diff(&screen), b"\x07"); let screen = parser.screen().clone(); parser.process(b"\x07\x07\x07"); assert_eq!(parser.screen().audible_bell_count(), 5); - assert_eq!(parser.screen().contents_diff(&screen), b"\x07"); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!(parser.screen().bells_diff(&screen), b"\x07"); let screen = parser.screen().clone(); parser.process(b"foo"); assert_eq!(parser.screen().audible_bell_count(), 5); assert_eq!(parser.screen().contents_diff(&screen), b"foo"); + assert_eq!(parser.screen().bells_diff(&screen), b""); let screen = parser.screen().clone(); parser.process(b"ba\x07r"); assert_eq!(parser.screen().audible_bell_count(), 6); - assert_eq!(parser.screen().contents_diff(&screen), b"bar\x07"); + assert_eq!(parser.screen().contents_diff(&screen), b"bar"); + assert_eq!(parser.screen().bells_diff(&screen), b"\x07"); } #[test] diff --git a/tests/escape.rs b/tests/escape.rs index 96ee762..67d6a87 100644 --- a/tests/escape.rs +++ b/tests/escape.rs @@ -68,6 +68,10 @@ fn ris() { &b"\x1b[?25l\x1b[m\x1b[H\x1b[Jf\x1b[31;47;1;3;4moo\x1b[21;21H\x1b[7m" [..] ); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]1;window icon name\x07\x1b]2;window title\x07"[..] + ); assert_eq!(parser.screen().title(), "window title"); assert_eq!(parser.screen().icon_name(), "window icon name"); @@ -96,7 +100,11 @@ fn ris() { assert_eq!(parser.screen().contents(), ""); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + &b"\x1b[?25h\x1b[m\x1b[H\x1b[J"[..] + ); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]1;window icon name\x07\x1b]2;window title\x07"[..] ); // title and icon name don't change with reset @@ -130,27 +138,32 @@ fn vb() { parser.process(b"\x1bg"); assert_eq!(parser.screen().visual_bell_count(), 1); assert_eq!(parser.screen().visual_bell_count(), 1); - assert_eq!(parser.screen().contents_diff(&screen), b"\x1bg"); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!(parser.screen().bells_diff(&screen), b"\x1bg"); let screen = parser.screen().clone(); parser.process(b"\x1bg"); assert_eq!(parser.screen().visual_bell_count(), 2); - assert_eq!(parser.screen().contents_diff(&screen), b"\x1bg"); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!(parser.screen().bells_diff(&screen), b"\x1bg"); let screen = parser.screen().clone(); parser.process(b"\x1bg\x1bg\x1bg"); assert_eq!(parser.screen().visual_bell_count(), 5); - assert_eq!(parser.screen().contents_diff(&screen), b"\x1bg"); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!(parser.screen().bells_diff(&screen), b"\x1bg"); let screen = parser.screen().clone(); parser.process(b"foo"); assert_eq!(parser.screen().visual_bell_count(), 5); assert_eq!(parser.screen().contents_diff(&screen), b"foo"); + assert_eq!(parser.screen().bells_diff(&screen), b""); let screen = parser.screen().clone(); parser.process(b"ba\x1bgr"); assert_eq!(parser.screen().visual_bell_count(), 6); - assert_eq!(parser.screen().contents_diff(&screen), b"bar\x1bg"); + assert_eq!(parser.screen().contents_diff(&screen), b"bar"); + assert_eq!(parser.screen().bells_diff(&screen), b"\x1bg"); } #[test] diff --git a/tests/mode.rs b/tests/mode.rs index 5e222fe..e2404c6 100644 --- a/tests/mode.rs +++ b/tests/mode.rs @@ -15,7 +15,16 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1l\x1b[?2004l" + ); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1h"); assert!(!parser.screen().application_keypad()); @@ -30,7 +39,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?9h"); assert!(!parser.screen().application_keypad()); @@ -45,7 +65,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?9h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?9h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?25l"); assert!(!parser.screen().application_keypad()); @@ -60,7 +91,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b"\x1b[?25l"); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?9h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b""); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1000h"); assert!(!parser.screen().application_keypad()); @@ -75,7 +117,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?1000h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1000h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1002h"); assert!(!parser.screen().application_keypad()); @@ -90,7 +143,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?1002h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1002h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1003h"); assert!(!parser.screen().application_keypad()); @@ -105,7 +169,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?1003h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1003h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1005h"); assert!(!parser.screen().application_keypad()); @@ -120,7 +195,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Utf8 ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?1003h\x1b[?1005h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1005h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1006h"); assert!(!parser.screen().application_keypad()); @@ -135,7 +221,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004l\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1006h"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?2004h"); assert!(!parser.screen().application_keypad()); @@ -150,7 +247,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1h\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?2004h"); + let screen = parser.screen().clone(); parser.process(b"\x1b="); assert!(parser.screen().application_keypad()); @@ -165,7 +273,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1h\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b="); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1l"); assert!(parser.screen().application_keypad()); @@ -180,7 +299,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1l"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?9l"); assert!(parser.screen().application_keypad()); @@ -195,7 +325,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25l\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b""); + let screen = parser.screen().clone(); parser.process(b"\x1b[?25h"); assert!(parser.screen().application_keypad()); @@ -210,7 +351,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b"\x1b[?25h"); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b""); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1000l"); assert!(parser.screen().application_keypad()); @@ -225,7 +377,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b""); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1002l"); assert!(parser.screen().application_keypad()); @@ -240,7 +403,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1003h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b""); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1003l"); assert!(parser.screen().application_keypad()); @@ -255,7 +429,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1003l"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1005l"); assert!(parser.screen().application_keypad()); @@ -270,7 +455,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Sgr ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h\x1b[?1006h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b""); + let screen = parser.screen().clone(); parser.process(b"\x1b[?1006l"); assert!(parser.screen().application_keypad()); @@ -285,7 +481,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004h" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?1006l"); + let screen = parser.screen().clone(); parser.process(b"\x1b[?2004l"); assert!(parser.screen().application_keypad()); @@ -300,7 +507,18 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b=\x1b[?1l\x1b[?2004l" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b[?2004l"); + let screen = parser.screen().clone(); parser.process(b"\x1b>"); assert!(!parser.screen().application_keypad()); @@ -315,6 +533,16 @@ fn modes() { parser.screen().mouse_protocol_encoding(), vt100::MouseProtocolEncoding::Default ); + assert_eq!( + parser.screen().contents_formatted(), + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" + ); + assert_eq!(parser.screen().contents_diff(&screen), b""); + assert_eq!( + parser.screen().input_mode_formatted(), + b"\x1b>\x1b[?1l\x1b[?2004l" + ); + assert_eq!(parser.screen().input_mode_diff(&screen), b"\x1b>"); } #[test] diff --git a/tests/osc.rs b/tests/osc.rs index f9bcc67..7fd7e82 100644 --- a/tests/osc.rs +++ b/tests/osc.rs @@ -5,12 +5,26 @@ fn title() { let mut parser = vt100::Parser::default(); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), ""); + + let screen = parser.screen().clone(); parser.process(b"\x1b]2;it's a title\x07"); assert_eq!(parser.screen().title(), "it's a title"); assert_eq!(parser.screen().icon_name(), ""); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]2;it's a title\x07"[..] + ); + assert_eq!( + parser.screen().title_diff(&screen), + &b"\x1b]2;it's a title\x07"[..] + ); + + let screen = parser.screen().clone(); parser.process(b"\x1b]2;\x07"); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), ""); + assert_eq!(parser.screen().title_formatted(), &b""[..]); + assert_eq!(parser.screen().title_diff(&screen), &b"\x1b]0;\x07"[..]); } #[test] @@ -18,12 +32,26 @@ fn icon_name() { let mut parser = vt100::Parser::default(); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), ""); + + let screen = parser.screen().clone(); parser.process(b"\x1b]1;it's an icon name\x07"); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), "it's an icon name"); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]1;it's an icon name\x07"[..] + ); + assert_eq!( + parser.screen().title_diff(&screen), + &b"\x1b]1;it's an icon name\x07"[..] + ); + + let screen = parser.screen().clone(); parser.process(b"\x1b]1;\x07"); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), ""); + assert_eq!(parser.screen().title_formatted(), &b""[..]); + assert_eq!(parser.screen().title_diff(&screen), &b"\x1b]0;\x07"[..]); } #[test] @@ -31,12 +59,61 @@ fn title_icon_name() { let mut parser = vt100::Parser::default(); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), ""); + + let screen = parser.screen().clone(); parser.process(b"\x1b]0;it's both\x07"); assert_eq!(parser.screen().title(), "it's both"); assert_eq!(parser.screen().icon_name(), "it's both"); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]0;it's both\x07"[..] + ); + assert_eq!( + parser.screen().title_diff(&screen), + &b"\x1b]0;it's both\x07"[..] + ); + + let screen = parser.screen().clone(); parser.process(b"\x1b]0;\x07"); assert_eq!(parser.screen().title(), ""); assert_eq!(parser.screen().icon_name(), ""); + assert_eq!(parser.screen().title_formatted(), &b""[..]); + assert_eq!(parser.screen().title_diff(&screen), &b"\x1b]0;\x07"[..]); + + let screen = parser.screen().clone(); + parser.process(b"\x1b]2;it's a title\x07\x1b]1;it's an icon name\x07"); + assert_eq!(parser.screen().title(), "it's a title"); + assert_eq!(parser.screen().icon_name(), "it's an icon name"); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]1;it's an icon name\x07\x1b]2;it's a title\x07"[..] + ); + assert_eq!( + parser.screen().title_diff(&screen), + &b"\x1b]1;it's an icon name\x07\x1b]2;it's a title\x07"[..] + ); + + let screen = parser.screen().clone(); + parser.process(b"\x1b]1;it's a title\x07"); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]0;it's a title\x07"[..] + ); + assert_eq!( + parser.screen().title_diff(&screen), + &b"\x1b]0;it's a title\x07"[..] + ); + + let screen = parser.screen().clone(); + parser.process(b"\x1b]1;it's an icon name\x07"); + assert_eq!( + parser.screen().title_formatted(), + &b"\x1b]1;it's an icon name\x07\x1b]2;it's a title\x07"[..] + ); + assert_eq!( + parser.screen().title_diff(&screen), + &b"\x1b]1;it's an icon name\x07"[..] + ); } #[test] |