File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/borrow_tracker/tree_borrows Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -790,4 +790,32 @@ mod propagation_optimization_checks {
790790 ) ;
791791 }
792792 }
793+
794+ /// Checks that `strongest_allowed_child_access` correctly
795+ /// represents which transitions are possible.
796+ #[ test]
797+ fn strongest_allowed_child_access ( ) {
798+ for ( permission, protected) in <( Permission , bool ) >:: exhaustive ( ) {
799+ let strongest_child_access = permission. strongest_allowed_child_access ( protected) ;
800+
801+ let is_read_valid = Permission :: perform_access (
802+ AccessKind :: Read ,
803+ AccessRelatedness :: LocalAccess ,
804+ permission,
805+ protected,
806+ )
807+ . is_some ( ) ;
808+
809+ let is_write_valid = Permission :: perform_access (
810+ AccessKind :: Write ,
811+ AccessRelatedness :: LocalAccess ,
812+ permission,
813+ protected,
814+ )
815+ . is_some ( ) ;
816+
817+ assert_eq ! ( is_read_valid, strongest_child_access >= WildcardAccessLevel :: Read ) ;
818+ assert_eq ! ( is_write_valid, strongest_child_access >= WildcardAccessLevel :: Write ) ;
819+ }
820+ }
793821}
You can’t perform that action at this time.
0 commit comments