#![cfg(feature = "term")] use key::Key; use lb::term::key; #[test] fn keys_next() { let values = [ b'a', b'b', 27, // 27, b'[', b'A', // 27, b'[', b'B', // 27, b'[', b'C', // 27, b'[', b'D', // 27, b'[', b'H', // 3, 27, b'[', // ]; let keys = key::Keys::with_filled_buffer(&values[..]); let expected = [ Key::Char(b'a'), Key::Char(b'b'), Key::Esc, Key::Up, Key::Down, Key::Right, Key::Left, Key::Esc, Key::Char(b'['), Key::Char(b'H'), Key::Char(3), Key::Esc, Key::Char(b'['), ]; let actual: &[_] = &keys.collect::>(); assert_eq!(expected, actual); }