MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_nesting

Function test_nesting

src/repr/src/row.rs:3897–3926  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3895
3896 #[mz_ore::test]
3897 fn test_nesting() {
3898 let mut row = Row::default();
3899 row.packer().push_dict_with(|row| {
3900 row.push(Datum::String("favourites"));
3901 row.push_list_with(|row| {
3902 row.push(Datum::String("ice cream"));
3903 row.push(Datum::String("oreos"));
3904 row.push(Datum::String("cheesecake"));
3905 });
3906 row.push(Datum::String("name"));
3907 row.push(Datum::String("bob"));
3908 });
3909
3910 let mut iter = row.unpack_first().unwrap_map().iter();
3911
3912 let (k, v) = iter.next().unwrap();
3913 assert_eq!(k, "favourites");
3914 assert_eq!(
3915 v.unwrap_list().iter().collect::<Vec<_>>(),
3916 vec![
3917 Datum::String("ice cream"),
3918 Datum::String("oreos"),
3919 Datum::String("cheesecake"),
3920 ]
3921 );
3922
3923 let (k, v) = iter.next().unwrap();
3924 assert_eq!(k, "name");
3925 assert_eq!(v, Datum::String("bob"));
3926 }
3927
3928 #[mz_ore::test]
3929 fn test_dict_errors() -> Result<(), Box<dyn std::error::Error>> {

Callers

nothing calls this directly

Calls 10

StringClass · 0.85
push_dict_withMethod · 0.80
packerMethod · 0.80
push_list_withMethod · 0.80
unwrap_mapMethod · 0.80
unpack_firstMethod · 0.80
unwrapMethod · 0.80
pushMethod · 0.45
iterMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected