Implemented unit tests for ui utils

This commit is contained in:
2023-08-08 10:50:05 -06:00
parent e9b37e23ae
commit 110da1c0ee
6 changed files with 429 additions and 23 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
use std::sync::mpsc;
use std::sync::mpsc::{Receiver, Sender};
use std::sync::mpsc::Receiver;
use std::thread;
use std::time::{Duration, Instant};
+3 -2
View File
@@ -80,17 +80,18 @@ impl From<KeyEvent> for Key {
#[cfg(test)]
mod tests {
use crossterm::event::{KeyCode, KeyEvent};
use pretty_assertions::{assert_eq, assert_str_eq};
use crate::event::key::Key;
#[test]
fn test_key_formatter() {
assert_eq!(format!("{}", Key::Esc), "<Esc>");
assert_str_eq!(format!("{}", Key::Esc), "<Esc>");
}
#[test]
fn test_key_formatter_char() {
assert_eq!(format!("{}", Key::Char('q')), "<q>");
assert_str_eq!(format!("{}", Key::Char('q')), "<q>");
}
#[test]