Rich-T-kid commented on code in PR #10695:
URL: https://github.com/apache/arrow-rs/pull/10695#discussion_r3789604765
##########
arrow-schema/src/metadata.rs:
##########
@@ -445,6 +458,35 @@ mod tests {
assert_eq!(format!("{metadata:?}"), r#"{"a": "1", "b": "2"}"#);
assert_eq!(format!("{:?}", Metadata::new()), "{}");
}
+ #[test]
+ fn test_retain() {
+ let mut metadata =
+ Metadata::from([("a", "1"), ("b", "2"), ("c", "3"), ("d", "4"),
("e", "5")]);
+
+ metadata.retain(|k, _| -> bool { k >= &String::from("c") });
+
+ let result_map = Metadata::from([("c", "3"), ("d", "4"), ("e", "5")]);
+ assert_eq!(metadata, result_map)
+ }
+
+ #[test]
Review Comment:
also added a test for when `retain()` clears all the maps contents. the
metadata becomes `None`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]