@@ -515,12 +515,17 @@ pub mod tests {
515515
516516 // ** Test structs
517517
518+ #[ cfg( feature = "map" ) ]
519+ type Child2Map = HashMap < i32 , Child2 > ;
520+ #[ cfg( not( feature = "map" ) ) ]
521+ type Child2Map = ( ) ;
522+
518523 #[ derive( Debug , Clone , PartialEq ) ]
519524 #[ cfg_attr( feature = "serde" , derive( serde:: Serialize ) ) ]
520525 pub struct Parent {
521526 pub c1 : Child1 ,
522527 pub c2 : Vec < Child1 > ,
523- pub c3 : HashMap < i32 , Child2 > ,
528+ pub c3 : Child2Map ,
524529 pub val : String ,
525530 }
526531
@@ -571,7 +576,7 @@ pub mod tests {
571576 pub struct ParentDiff < ' a > {
572577 pub c1 : <Child1 as Diffable < ' a > >:: Diff ,
573578 pub c2 : <Vec < Child1 > as Diffable < ' a > >:: Diff ,
574- pub c3 : <HashMap < i32 , Child2 > as Diffable < ' a > >:: Diff ,
579+ pub c3 : <Child2Map as Diffable < ' a > >:: Diff ,
575580 pub val : <String as Diffable < ' a > >:: Diff ,
576581 }
577582
@@ -708,6 +713,7 @@ pub mod tests {
708713
709714 #[ test]
710715 fn smoke_test ( ) {
716+ #[ cfg( feature = "map" ) ]
711717 fn dummy_child2 ( ) -> Child2 {
712718 Child2 {
713719 a : "ayeaye" . into ( ) ,
@@ -728,6 +734,7 @@ pub mod tests {
728734 x: 234 ,
729735 y: "yazoo" . into( ) ,
730736 } ] ,
737+ #[ cfg( feature = "map" ) ]
731738 c3 : [ (
732739 321 ,
733740 Child2 {
@@ -738,6 +745,8 @@ pub mod tests {
738745 ) ]
739746 . into_iter ( )
740747 . collect ( ) ,
748+ #[ cfg( not( feature = "map" ) ) ]
749+ c3 : ( ) ,
741750 val : "hello" . into ( ) ,
742751 } ;
743752
@@ -760,14 +769,18 @@ pub mod tests {
760769 let expect = DeepDiff :: Patched ( ParentDiff {
761770 c1 : DeepDiff :: Unchanged ,
762771 c2 : VecDiff :: Unchanged ,
772+ #[ cfg( feature = "map" ) ]
763773 c3 : DeepDiff :: Unchanged ,
774+ #[ cfg( not( feature = "map" ) ) ]
775+ c3 : Id :: new ( ) ,
764776 val : AtomicDiff :: Replaced ( & mello) ,
765777 } ) ;
766778 assert_eq ! ( diff, expect) ;
767779 assert ! ( p3. apply( & diff) . is_ok( ) ) ;
768780 assert_eq ! ( p3, p4) ;
769781 }
770782
783+ #[ cfg( feature = "map" ) ]
771784 {
772785 let mut p5 = base. clone ( ) ;
773786 let dummy = dummy_child2 ( ) ;
@@ -789,6 +802,7 @@ pub mod tests {
789802 assert_eq ! ( err, [ ApplyError :: MissingKey , ApplyError :: UnexpectedKey ] ) ;
790803 }
791804
805+ #[ cfg( feature = "map" ) ]
792806 {
793807 let mut map1 = BTreeMap :: new ( ) ;
794808 let map2 = BTreeMap :: from ( [ ( "hello" , "world" ) ] ) ;
0 commit comments