diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-04-28 03:24:44 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-04-28 03:24:44 -0400 |
commit | 33aac534a00cd05499820bb1892c1c9226eb2acc (patch) | |
tree | d4104d890e0c88738ae44daaf3421bfa85ab0813 /tests/osc.rs | |
parent | a753152bf92f365afa6976293dec0dc03717c091 (diff) | |
download | vt100-rust-33aac534a00cd05499820bb1892c1c9226eb2acc.tar.gz vt100-rust-33aac534a00cd05499820bb1892c1c9226eb2acc.zip |
add a bunch of tests
Diffstat (limited to 'tests/osc.rs')
-rw-r--r-- | tests/osc.rs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/osc.rs b/tests/osc.rs new file mode 100644 index 0000000..59ab943 --- /dev/null +++ b/tests/osc.rs @@ -0,0 +1,51 @@ +extern crate vt100; + +mod support; +use support::TestHelpers; + +#[test] +fn title() { + let mut screen = vt100::Screen::new(24, 80); + assert!(screen.title().is_none()); + assert!(screen.icon_name().is_none()); + screen.assert_process(b"\x1b]2;it's a title\x07"); + assert_eq!(screen.title().unwrap(), "it's a title"); + assert!(screen.icon_name().is_none()); + screen.assert_process(b"\x1b]2;\x07"); + assert_eq!(screen.title().unwrap(), ""); + assert!(screen.icon_name().is_none()); +} + +#[test] +fn icon_name() { + let mut screen = vt100::Screen::new(24, 80); + assert!(screen.title().is_none()); + assert!(screen.icon_name().is_none()); + screen.assert_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"); + screen.assert_process(b"\x1b]1;\x07"); + assert!(screen.title().is_none()); + assert_eq!(screen.icon_name().unwrap(), ""); +} + +#[test] +fn title_icon_name() { + let mut screen = vt100::Screen::new(24, 80); + assert!(screen.title().is_none()); + assert!(screen.icon_name().is_none()); + screen.assert_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"); + screen.assert_process(b"\x1b]0;\x07"); + assert_eq!(screen.title().unwrap(), ""); + assert_eq!(screen.icon_name().unwrap(), ""); +} + +#[test] +fn unknown_sequence() { + let mut screen = vt100::Screen::new(24, 80); + assert_eq!(screen.cell(0, 0).unwrap().contents(), ""); + screen.assert_process(b"\x1b]499;some long, long string?\x07"); + assert_eq!(screen.cell(0, 0).unwrap().contents(), ""); +} |