From e2aeb18fa5f05458bdaa8488cc6424109f908855 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 1 Nov 2019 15:08:32 -0400 Subject: there's no reason title and icon_name should be options --- tests/escape.rs | 12 ++++++------ tests/init.rs | 4 ++-- tests/osc.rs | 36 ++++++++++++++++++------------------ tests/processing.rs | 24 ++++++++++++------------ 4 files changed, 38 insertions(+), 38 deletions(-) (limited to 'tests') diff --git a/tests/escape.rs b/tests/escape.rs index e80234a..1651ee5 100644 --- a/tests/escape.rs +++ b/tests/escape.rs @@ -37,8 +37,8 @@ fn ris() { "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" ); - assert_eq!(screen.title(), None); - assert_eq!(screen.icon_name(), None); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); assert_eq!(screen.fgcolor(), vt100::Color::Default); assert_eq!(screen.bgcolor(), vt100::Color::Default); @@ -72,8 +72,8 @@ fn ris() { ); assert_eq!(screen.window_contents_formatted(0, 0, 23, 79), "f\x1b[31;47;1;3;4moo\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - assert_eq!(screen.title().unwrap(), "window title"); - assert_eq!(screen.icon_name().unwrap(), "window icon name"); + assert_eq!(screen.title(), "window title"); + assert_eq!(screen.icon_name(), "window icon name"); assert_eq!(screen.fgcolor(), vt100::Color::Idx(1)); assert_eq!(screen.bgcolor(), vt100::Color::Idx(7)); @@ -110,8 +110,8 @@ fn ris() { ); // title and icon name don't change with reset - assert_eq!(screen.title().unwrap(), "window title"); - assert_eq!(screen.icon_name().unwrap(), "window icon name"); + assert_eq!(screen.title(), "window title"); + assert_eq!(screen.icon_name(), "window icon name"); assert_eq!(screen.fgcolor(), vt100::Color::Default); assert_eq!(screen.bgcolor(), vt100::Color::Default); diff --git a/tests/init.rs b/tests/init.rs index f5c896a..4eb3910 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -25,8 +25,8 @@ fn init() { "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" ); - assert_eq!(screen.title(), None); - assert_eq!(screen.icon_name(), None); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); assert_eq!(screen.fgcolor(), vt100::Color::Default); assert_eq!(screen.bgcolor(), vt100::Color::Default); diff --git a/tests/osc.rs b/tests/osc.rs index 001ad53..4a02592 100644 --- a/tests/osc.rs +++ b/tests/osc.rs @@ -1,40 +1,40 @@ #[test] fn title() { let mut screen = vt100::Screen::new(24, 80); - assert!(screen.title().is_none()); - assert!(screen.icon_name().is_none()); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); screen.process(b"\x1b]2;it's a title\x07"); - assert_eq!(screen.title().unwrap(), "it's a title"); - assert!(screen.icon_name().is_none()); + assert_eq!(screen.title(), "it's a title"); + assert_eq!(screen.icon_name(), ""); screen.process(b"\x1b]2;\x07"); - assert_eq!(screen.title().unwrap(), ""); - assert!(screen.icon_name().is_none()); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); } #[test] fn icon_name() { let mut screen = vt100::Screen::new(24, 80); - assert!(screen.title().is_none()); - assert!(screen.icon_name().is_none()); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); screen.process(b"\x1b]1;it's an icon name\x07"); - assert!(screen.title().is_none()); - assert_eq!(screen.icon_name().unwrap(), "it's an icon name"); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), "it's an icon name"); screen.process(b"\x1b]1;\x07"); - assert!(screen.title().is_none()); - assert_eq!(screen.icon_name().unwrap(), ""); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); } #[test] fn title_icon_name() { let mut screen = vt100::Screen::new(24, 80); - assert!(screen.title().is_none()); - assert!(screen.icon_name().is_none()); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); screen.process(b"\x1b]0;it's both\x07"); - assert_eq!(screen.title().unwrap(), "it's both"); - assert_eq!(screen.icon_name().unwrap(), "it's both"); + assert_eq!(screen.title(), "it's both"); + assert_eq!(screen.icon_name(), "it's both"); screen.process(b"\x1b]0;\x07"); - assert_eq!(screen.title().unwrap(), ""); - assert_eq!(screen.icon_name().unwrap(), ""); + assert_eq!(screen.title(), ""); + assert_eq!(screen.icon_name(), ""); } #[test] diff --git a/tests/processing.rs b/tests/processing.rs index 0e801d2..b5b212a 100644 --- a/tests/processing.rs +++ b/tests/processing.rs @@ -73,59 +73,59 @@ fn split_escape_sequences() { assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); screen.process(b"\x1b"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"]"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"0"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b";"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"a"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b" "); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"'"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"["); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"]"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"_"); - assert_eq!(screen.title(), None); + assert_eq!(screen.title(), ""); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); screen.process(b"\x07"); - assert_eq!(screen.title(), Some("a '[]_")); + assert_eq!(screen.title(), "a '[]_"); assert!(screen.mouse_reporting_press_release()); assert_eq!(screen.cursor_position(), (11, 23)); assert_eq!(screen.window_contents(0, 0, 23, 79), contents); -- cgit v1.2.3-54-g00ecf