@@ -141,8 +141,10 @@ fn all_attributes_are_listed_in_declaration_order() -> crate::Result {
141
141
true , /* use macros */
142
142
) ?;
143
143
144
- let mut out = gix_attributes :: search :: Outcome :: default ( ) ;
144
+ let mut out = Outcome :: default ( ) ;
145
145
out. initialize ( & collection) ;
146
+ let mut alt = Outcome :: default ( ) ;
147
+ alt. initialize ( & collection) ;
146
148
147
149
let mut orders = collection
148
150
. iter ( )
@@ -206,10 +208,13 @@ fn all_attributes_are_listed_in_declaration_order() -> crate::Result {
206
208
assert_references ( & out) ;
207
209
let actual: Vec < _ > = out. iter ( ) . map ( |m| m. assignment ) . collect ( ) ;
208
210
assert_eq ! (
209
- by_name( actual) ,
211
+ by_name( actual. clone ( ) ) ,
210
212
by_name( expected) ,
211
213
"{rela_path}: the order of everything matches perfectly"
212
214
) ;
215
+ out. copy_into ( & collection, & mut alt) ;
216
+ let alt_actual: Vec < _ > = alt. iter ( ) . map ( |m| m. assignment ) . collect ( ) ;
217
+ assert_eq ! ( alt_actual, actual) ;
213
218
}
214
219
assert_eq ! (
215
220
out. iter( ) . count( ) ,
@@ -234,8 +239,10 @@ fn given_attributes_are_made_available_in_given_order() -> crate::Result {
234
239
true , /* use macros */
235
240
) ?;
236
241
237
- let mut out = gix_attributes :: search :: Outcome :: default ( ) ;
242
+ let mut out = Outcome :: default ( ) ;
238
243
out. initialize_with_selection ( & collection, [ "my-binary" , "recursive" , "unspecified" ] ) ;
244
+ let mut alt = Outcome :: default ( ) ;
245
+ alt. initialize_with_selection ( & collection, [ "my-binary" , "unspecified" ] ) ;
239
246
240
247
for ( rela_path, expected) in ( baseline:: Expectations { lines : input. lines ( ) } ) {
241
248
out. reset ( ) ;
@@ -246,6 +253,10 @@ fn given_attributes_are_made_available_in_given_order() -> crate::Result {
246
253
actual, expected,
247
254
"{rela_path}: the order of everything matches perfectly"
248
255
) ;
256
+ out. copy_into ( & collection, & mut alt) ;
257
+ let alt_actual: Vec < _ > = alt. iter_selected ( ) . map ( |m| m. assignment ) . collect ( ) ;
258
+ assert_eq ! ( alt_actual[ 0 ] , actual[ 0 ] ) ;
259
+ assert_eq ! ( alt_actual[ 1 ] , actual[ 2 ] ) ;
249
260
}
250
261
assert_eq ! (
251
262
out. iter( ) . count( ) ,
@@ -255,6 +266,15 @@ fn given_attributes_are_made_available_in_given_order() -> crate::Result {
255
266
Ok ( ( ) )
256
267
}
257
268
269
+ #[ test]
270
+ fn size_of_outcome ( ) {
271
+ assert_eq ! (
272
+ std:: mem:: size_of:: <Outcome >( ) ,
273
+ 904 ,
274
+ "it's quite big, shouldn't change without us noticing"
275
+ )
276
+ }
277
+
258
278
fn by_name ( assignments : Vec < AssignmentRef > ) -> BTreeMap < NameRef , StateRef > {
259
279
assignments. into_iter ( ) . map ( |a| ( a. name , a. state ) ) . collect ( )
260
280
}
0 commit comments