rluvaton commented on PR #8728:
URL: https://github.com/apache/arrow-rs/pull/8728#issuecomment-3458528559

   Cleaned up a code a bit.
   
   the idea is to create an infra to make the tests themself only about the 
relavent thing:
   
   so if I take this test for example
   ```rs
   #[test]
   fn assert_for_each() {
        // 1. the operation that we want to apply 
       struct ForEachOp;
   
       impl ConsumingArrayIteratorOp for ForEachOp {
           type Output = CallTrackingOnly;
   
           fn name(&self) -> String {
               "for_each".to_string()
           }
   
                // apply the operation and get result to compare
           fn get_value<T: SharedBetweenArrayIterAndSliceIter>(&self, iter: T) 
-> Self::Output {
               let mut items = Vec::with_capacity(iter.len());
   
                        // We are testing for_each so the thing we want to 
assert is the function arguments (and the order of the items)
               iter.for_each(|item| {
                   items.push(item);
               });
   
                        // Return the data we are asserting on
               CallTrackingAndResult {
                                // we pass the function calls to assert that 
they are the same as the source of truth iterator (slice in our case)
                   calls: items,
                                // this function does not have a return value 
so we pass ()
                   result: (),
               }
           }
       }
   
       assert_array_iterator_cases(ForEachOp)
   }
   ``` 


-- 
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]

Reply via email to