MCPcopy Create free account
hub / github.com/carllerche/assert-struct / test_nested_patterns

Function test_nested_patterns

assert-struct/tests/maps.rs:132–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

130
131#[test]
132fn test_nested_patterns() {
133 let mut nested_map = HashMap::new();
134 nested_map.insert(
135 "item1".to_string(),
136 TestNested {
137 value: "test".to_string(),
138 count: 5,
139 },
140 );
141 nested_map.insert(
142 "item2".to_string(),
143 TestNested {
144 value: "example".to_string(),
145 count: 10,
146 },
147 );
148
149 let data = TestData {
150 string_map: HashMap::new(),
151 int_map: HashMap::new(),
152 btree_map: BTreeMap::new(),
153 nested_map,
154 };
155
156 // Test nested struct patterns in map values
157 assert_struct!(data, TestData {
158 nested_map: #{
159 "item1": TestNested {
160 value: "test",
161 count: >= 5,
162 ..
163 },
164 "item2": TestNested {
165 value: "example",
166 count: > 5,
167 ..
168 },
169 },
170 ..
171 });
172}
173
174#[test]
175#[cfg(feature = "regex")]

Callers

nothing calls this directly

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected