From c9b957bcdfcd1cedbd8a1f3c5e16d1e4382b54c2 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 9 Mar 2021 01:46:51 -0500 Subject: fix attributes_formatted, remove attributes_diff also improve the documentation and add more tests --- tests/attr.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/attr.rs b/tests/attr.rs index 64f4bd4..34ac7af 100644 --- a/tests/attr.rs +++ b/tests/attr.rs @@ -9,3 +9,15 @@ fn colors() { fn attrs() { helpers::fixture("attrs"); } + +#[test] +fn attributes_formatted() { + let mut parser = vt100::Parser::default(); + assert_eq!(parser.screen().attributes_formatted(), b"\x1b[m"); + parser.process(b"\x1b[32mfoo\x1b[41mbar\x1b[33mbaz"); + assert_eq!(parser.screen().attributes_formatted(), b"\x1b[m\x1b[33;41m"); + parser.process(b"\x1b[1m\x1b[39m"); + assert_eq!(parser.screen().attributes_formatted(), b"\x1b[m\x1b[41;1m"); + parser.process(b"\x1b[m"); + assert_eq!(parser.screen().attributes_formatted(), b"\x1b[m"); +} -- cgit v1.2.3-54-g00ecf