Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Aug 7, 2024
1 parent e7e0c5d commit 3cc6b8c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl Command for DisableBlinking {
/// # Note
///
/// - Commands must be executed/queued for execution otherwise they do nothing.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash)]
pub enum SetCursorStyle {
/// Default cursor shape configured by the user.
DefaultUserShape,
Expand Down Expand Up @@ -427,6 +427,7 @@ impl_display!(for SetCursorStyle);
#[cfg(test)]
#[cfg(feature = "events")]
mod tests {
use std::hash::{DefaultHasher, Hash};
use std::io::{self, stdout};

use crate::execute;
Expand Down Expand Up @@ -509,5 +510,22 @@ mod tests {
assert!(SetCursorStyle::BlinkingBlock != SetCursorStyle::BlinkingUnderScore);
assert_eq!(SetCursorStyle::BlinkingBlock, SetCursorStyle::BlinkingBlock);
assert_eq!(format!("{:?}", SetCursorStyle::SteadyBar), "SteadyBar");
let s1 = SetCursorStyle::DefaultUserShape;
let s2 = s1;
let s3 = s1.clone();
assert!(s2 == s1);
assert!(s3 == s1);
let mut hasher = DefaultHasher::new();
let h1 = &s1;
let h2 = &s2;
let h3 = &s3;
assert!(h1.hash(&mut hasher) == h2.hash(&mut hasher));
assert!(h1.hash(&mut hasher) == h3.hash(&mut hasher));
assert!(SetCursorStyle::DefaultUserShape < SetCursorStyle::BlinkingBlock);
assert!(SetCursorStyle::BlinkingBlock < SetCursorStyle::SteadyBlock);
assert!(SetCursorStyle::SteadyBlock < SetCursorStyle::BlinkingUnderScore);
assert!(SetCursorStyle::BlinkingUnderScore < SetCursorStyle::SteadyUnderScore);
assert!(SetCursorStyle::SteadyUnderScore < SetCursorStyle::BlinkingBar);
assert!(SetCursorStyle::BlinkingBar < SetCursorStyle::SteadyBar);
}
}

0 comments on commit 3cc6b8c

Please sign in to comment.