From d743018c4c0ae459a9586898a4dca132eecad3cb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 8 Nov 2019 11:02:10 -0500 Subject: fix tests for the attribute reset change --- tests/csi.rs | 24 ++++++++++++------------ tests/escape.rs | 12 ++++++------ tests/init.rs | 2 +- tests/text.rs | 12 ++++++------ tests/window_contents.rs | 22 +++++++++++----------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/csi.rs b/tests/csi.rs index e0cfa39..e5e19cd 100644 --- a/tests/csi.rs +++ b/tests/csi.rs @@ -180,7 +180,7 @@ fn ed() { ); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\x1b[5;5H" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[5;5H" ); parser.process(b"\x1b[41m\x1b[J"); @@ -207,7 +207,7 @@ fn ed() { assert_eq!( parser.screen().contents_formatted(), format!( - "\x1b[?25h\x1b[H\x1b[J{}{}\x1b[41m{}\r\n{}{}\x1b[5;5H", + "\x1b[?25h\x1b[m\x1b[H\x1b[J{}{}\x1b[41m{}\r\n{}{}\x1b[5;5H", "\r\n".repeat(4), "\x1b[C".repeat(4), "\x1b[X\x1b[C".repeat(76), @@ -232,7 +232,7 @@ fn ed() { ); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\x1b[5;5H" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[5;5H" ); parser.process(b"\x1b[41m\x1b[1J"); @@ -259,7 +259,7 @@ fn ed() { assert_eq!( parser.screen().contents_formatted(), format!( - "\x1b[?25h\x1b[H\x1b[J\x1b[41m{}{}\x1b[5;5H", + "\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[41m{}{}\x1b[5;5H", format!("{}\r\n", "\x1b[X\x1b[C".repeat(80)).repeat(4), "\x1b[X\x1b[C".repeat(5), ) @@ -281,7 +281,7 @@ fn ed() { ); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\x1b[5;5H" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[5;5H" ); parser.process(b"\x1b[41m\x1b[2J"); @@ -308,7 +308,7 @@ fn ed() { assert_eq!( parser.screen().contents_formatted(), format!( - "\x1b[?25h\x1b[H\x1b[J\x1b[41m{}{}\x1b[5;5H", + "\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[41m{}{}\x1b[5;5H", format!("{}\r\n", "\x1b[X\x1b[C".repeat(80)).repeat(23), "\x1b[X\x1b[C".repeat(80), ) @@ -403,7 +403,7 @@ fn el() { ); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\x1b[5;5H" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[5;5H" ); parser.process(b"\x1b[41m\x1b[K"); @@ -422,7 +422,7 @@ fn el() { assert_eq!( parser.screen().contents_formatted(), format!( - "\x1b[?25h\x1b[H\x1b[J{}{}\x1b[41m{}\x1b[5;5H", + "\x1b[?25h\x1b[m\x1b[H\x1b[J{}{}\x1b[41m{}\x1b[5;5H", "\r\n".repeat(4), "\x1b[C".repeat(4), "\x1b[X\x1b[C".repeat(76) @@ -445,7 +445,7 @@ fn el() { ); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\x1b[5;5H" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[5;5H" ); parser.process(b"\x1b[41m\x1b[1K"); @@ -464,7 +464,7 @@ fn el() { assert_eq!( parser.screen().contents_formatted(), format!( - "\x1b[?25h\x1b[H\x1b[J{}\x1b[41m{}\x1b[5;5H", + "\x1b[?25h\x1b[m\x1b[H\x1b[J{}\x1b[41m{}\x1b[5;5H", "\r\n".repeat(4), "\x1b[X\x1b[C".repeat(5), ) @@ -486,7 +486,7 @@ fn el() { ); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\x1b[5;5H" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[5;5H" ); parser.process(b"\x1b[41m\x1b[2K"); @@ -505,7 +505,7 @@ fn el() { assert_eq!( parser.screen().contents_formatted(), format!( - "\x1b[?25h\x1b[H\x1b[J{}\x1b[41m{}\x1b[5;5H", + "\x1b[?25h\x1b[m\x1b[H\x1b[J{}\x1b[41m{}\x1b[5;5H", "\r\n".repeat(4), "\x1b[X\x1b[C".repeat(80), ) diff --git a/tests/escape.rs b/tests/escape.rs index 88c926a..5ab8581 100644 --- a/tests/escape.rs +++ b/tests/escape.rs @@ -34,7 +34,7 @@ fn ris() { assert_eq!(parser.screen().contents(), ""); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" ); assert_eq!(parser.screen().title(), ""); @@ -73,7 +73,7 @@ fn ris() { assert_eq!(parser.screen().contents(), "foo"); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25l\x1b[H\x1b[Jf\x1b[31;47;1;3;4moo\x1b[21;21H"[..] + &b"\x1b[?25l\x1b[m\x1b[H\x1b[Jf\x1b[31;47;1;3;4moo\x1b[21;21H"[..] ); assert_eq!(parser.screen().title(), "window title"); @@ -111,7 +111,7 @@ fn ris() { assert_eq!(parser.screen().contents(), ""); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" ); // title and icon name don't change with reset @@ -177,20 +177,20 @@ fn decsc() { assert_eq!(parser.screen().cursor_position(), (4, 3)); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J\r\n\r\n\r\n\r\n\x1b[31mfoo" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J\r\n\r\n\r\n\r\n\x1b[31mfoo" ); parser.process(b"\x1b[32m\x1b[?6lbar"); assert_eq!(parser.screen().cursor_position(), (0, 3)); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[J\x1b[32mbar\r\n\r\n\r\n\r\n\x1b[31mfoo\x1b[1;4H"[..] + &b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[32mbar\r\n\r\n\r\n\r\n\x1b[31mfoo\x1b[1;4H"[..] ); parser.process(b"\x1b8\x1b[Hz"); assert_eq!(parser.screen().cursor_position(), (4, 1)); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[J\x1b[32mbar\r\n\r\n\r\n\r\n\x1b[31mzoo\x1b[5;2H"[..] + &b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[32mbar\r\n\r\n\r\n\r\n\x1b[31mzoo\x1b[5;2H"[..] ); } diff --git a/tests/init.rs b/tests/init.rs index f76ec49..7359c65 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -18,7 +18,7 @@ fn init() { assert_eq!(parser.screen().contents(), ""); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" ); assert_eq!(parser.screen().title(), ""); diff --git a/tests/text.rs b/tests/text.rs index 2469440..245a87f 100644 --- a/tests/text.rs +++ b/tests/text.rs @@ -60,7 +60,7 @@ fn wide() { assert_eq!(parser.screen().cursor_position(), (0, 6)); assert_eq!( parser.screen().contents_formatted(), - "\x1b[?25h\x1b[H\x1b[Jaデbネ".as_bytes() + "\x1b[?25h\x1b[m\x1b[H\x1b[Jaデbネ".as_bytes() ); assert_eq!( parser.screen().contents_diff(&screen), @@ -73,7 +73,7 @@ fn wide() { assert_eq!(parser.screen().cursor_position(), (0, 4)); assert_eq!( parser.screen().contents_formatted(), - "\x1b[?25h\x1b[H\x1b[Jaデcネ\x1b[1;5H".as_bytes() + "\x1b[?25h\x1b[m\x1b[H\x1b[Jaデcネ\x1b[1;5H".as_bytes() ); assert_eq!( parser.screen().contents_diff(&screen), @@ -86,7 +86,7 @@ fn wide() { assert_eq!(parser.screen().cursor_position(), (0, 12)); assert_eq!( parser.screen().contents_formatted(), - "\x1b[?25h\x1b[H\x1b[Jaデcネfoobar".as_bytes() + "\x1b[?25h\x1b[m\x1b[H\x1b[Jaデcネfoobar".as_bytes() ); assert_eq!( parser.screen().contents_diff(&screen), @@ -99,7 +99,7 @@ fn wide() { assert_eq!(parser.screen().cursor_position(), (0, 11)); assert_eq!( parser.screen().contents_formatted(), - "\x1b[?25h\x1b[H\x1b[Jデcネfoobar".as_bytes() + "\x1b[?25h\x1b[m\x1b[H\x1b[Jデcネfoobar".as_bytes() ); assert_eq!( parser.screen().contents_diff(&screen), @@ -112,7 +112,7 @@ fn wide() { assert_eq!(parser.screen().cursor_position(), (0, 12)); assert_eq!( parser.screen().contents_formatted(), - "\x1b[?25h\x1b[H\x1b[Jaデcネfoobar".as_bytes() + "\x1b[?25h\x1b[m\x1b[H\x1b[Jaデcネfoobar".as_bytes() ); assert_eq!( parser.screen().contents_diff(&screen), @@ -125,7 +125,7 @@ fn wide() { assert_eq!(parser.screen().cursor_position(), (0, 11)); assert_eq!( parser.screen().contents_formatted(), - "\x1b[?25h\x1b[H\x1b[Jデcネfoobar".as_bytes() + "\x1b[?25h\x1b[m\x1b[H\x1b[Jデcネfoobar".as_bytes() ); assert_eq!( parser.screen().contents_diff(&screen), diff --git a/tests/window_contents.rs b/tests/window_contents.rs index 29b76f8..851b128 100644 --- a/tests/window_contents.rs +++ b/tests/window_contents.rs @@ -6,7 +6,7 @@ fn formatted() { compare_formatted(parser.screen()); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J" ); parser.process(b"foobar"); @@ -17,7 +17,7 @@ fn formatted() { assert!(!parser.screen().cell(0, 5).unwrap().bold()); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[Jfoobar" + b"\x1b[?25h\x1b[m\x1b[H\x1b[Jfoobar" ); parser.process(b"\x1b[1;4H\x1b[1;7m\x1b[33mb"); @@ -28,7 +28,7 @@ fn formatted() { assert!(!parser.screen().cell(0, 5).unwrap().bold()); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[mar\x1b[1;5H"[..] + &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[mar\x1b[1;5H"[..] ); parser.process(b"\x1b[1;5H\x1b[22;42ma"); @@ -39,7 +39,7 @@ fn formatted() { assert!(!parser.screen().cell(0, 5).unwrap().bold()); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[42;22ma\x1b[mr\x1b[1;6H" + &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[42;22ma\x1b[mr\x1b[1;6H" [..] ); @@ -47,20 +47,20 @@ fn formatted() { compare_formatted(parser.screen()); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\nquux"[..] + &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\nquux"[..] ); parser.process(b"\x1b[2;1H\x1b[45mquux"); compare_formatted(parser.screen()); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[Jfoo\x1b[33;1;7mb\x1b[42;22ma\x1b[35mr\r\n\x1b[45mquux"[..] + &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jfoo\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.screen()); - assert_eq!(parser.screen().contents_formatted(), &b"\x1b[?25h\x1b[H\x1b[Jfoo\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(), &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jfoo\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"[..]); } #[test] @@ -71,7 +71,7 @@ fn empty_cells() { assert_eq!(parser.screen().contents(), "foo bar"); assert_eq!( parser.screen().contents_formatted(), - &b"\x1b[?25h\x1b[H\x1b[J\x1b[31mfoo\x1b[m\x1b[C\x1b[C\x1b[32m bar\x1b[1;4H"[..] + &b"\x1b[?25h\x1b[m\x1b[H\x1b[J\x1b[31mfoo\x1b[m\x1b[C\x1b[C\x1b[32m bar\x1b[1;4H"[..] ); } @@ -85,7 +85,7 @@ fn cursor_positioning() { assert_eq!(parser.screen().cursor_position(), (0, 1)); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J:" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J:" ); assert_eq!(parser.screen().contents_diff(&screen1), b"\x1b[m\x1b[1;1H:"); @@ -94,7 +94,7 @@ fn cursor_positioning() { assert_eq!(parser.screen().cursor_position(), (0, 2)); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J:a" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J:a" ); assert_eq!( parser.screen().contents_diff(&screen2), @@ -105,7 +105,7 @@ fn cursor_positioning() { assert_eq!(parser.screen().cursor_position(), (0, 1)); assert_eq!( parser.screen().contents_formatted(), - b"\x1b[?25h\x1b[H\x1b[J:" + b"\x1b[?25h\x1b[m\x1b[H\x1b[J:" ); assert_eq!( parser.screen().contents_diff(&screen3), -- cgit v1.2.3-54-g00ecf