From b2d6e18c8247794401df16a6c9277169fa66d646 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Fri, 15 Jul 2022 18:58:33 -0400 Subject: [PATCH] Format --- kakplugin/src/types.rs | 45 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/kakplugin/src/types.rs b/kakplugin/src/types.rs index 78af9bb..8aae5ec 100644 --- a/kakplugin/src/types.rs +++ b/kakplugin/src/types.rs @@ -58,11 +58,13 @@ impl SelectionDesc { left: self.left, right: self.left, }); + // My right is contained in b let right_contained = b.contains(&SelectionDesc { left: self.right, right: self.right, }); + // b is contaned in self let b_contained = self.contains(b); @@ -527,7 +529,7 @@ mod test { // Selection desc creator macro_rules! sd { ($b:expr, $d:expr) => {{ - sd!(1,$b,1,$d) + sd!(1, $b, 1, $d) }}; ($a:expr, $b:expr,$c:expr,$d:expr) => {{ SelectionDesc { @@ -543,40 +545,37 @@ mod test { #[test] fn test_anchor_position() { // Check parsing - assert_eq!(sd!(18,9,10,1), SD); + assert_eq!(sd!(18, 9, 10, 1), SD); // Check if multiple parsed ones match - assert_eq!( - sd!(18,9,10,1), - sd!(18,9,10,1) - ); + assert_eq!(sd!(18, 9, 10, 1), sd!(18, 9, 10, 1)); } #[test] fn test_sort() { // Check if sorting works - assert_eq!(SD.sort(), sd!(10,1,18,9)); + assert_eq!(SD.sort(), sd!(10, 1, 18, 9)); assert_eq!(SD.sort(), SD.sort().sort()); } #[test] fn test_contains() { assert!(SD.contains(&SD)); - assert!(SD.contains(&sd!(17,9,10,1))); - assert!(SD.contains(&sd!(18,8,10,1))); - assert!(SD.contains(&sd!(18,9,11,1))); - assert!(SD.contains(&sd!(18,9,10,2))); - assert!(SD.contains(&sd!(10,1,17,9))); - assert!(SD.contains(&sd!(10,1,18,8))); - assert!(SD.contains(&sd!(11,1,18,9))); - assert!(SD.contains(&sd!(10,2,18,9))); - assert!(!SD.contains(&sd!(19,9,10,1))); - assert!(!SD.contains(&sd!(18,10,10,1))); - assert!(!SD.contains(&sd!(18,9,9,1))); - assert!(!SD.contains(&sd!(18,9,10,0))); - assert!(!SD.contains(&sd!(10,1,19,9))); - assert!(!SD.contains(&sd!(10,1,18,10))); - assert!(!SD.contains(&sd!(9,1,18,9))); - assert!(!SD.contains(&sd!(10,0,18,9))); + assert!(SD.contains(&sd!(17, 9, 10, 1))); + assert!(SD.contains(&sd!(18, 8, 10, 1))); + assert!(SD.contains(&sd!(18, 9, 11, 1))); + assert!(SD.contains(&sd!(18, 9, 10, 2))); + assert!(SD.contains(&sd!(10, 1, 17, 9))); + assert!(SD.contains(&sd!(10, 1, 18, 8))); + assert!(SD.contains(&sd!(11, 1, 18, 9))); + assert!(SD.contains(&sd!(10, 2, 18, 9))); + assert!(!SD.contains(&sd!(19, 9, 10, 1))); + assert!(!SD.contains(&sd!(18, 10, 10, 1))); + assert!(!SD.contains(&sd!(18, 9, 9, 1))); + assert!(!SD.contains(&sd!(18, 9, 10, 0))); + assert!(!SD.contains(&sd!(10, 1, 19, 9))); + assert!(!SD.contains(&sd!(10, 1, 18, 10))); + assert!(!SD.contains(&sd!(9, 1, 18, 9))); + assert!(!SD.contains(&sd!(10, 0, 18, 9))); } #[test]