filter method

  1. @override
Test? filter(
  1. bool callback(
    1. Test
    )
)
override

Returns a copy of this with all tests that don't match callback removed.

Returns null if this is a test that doesn't match callback or a group where no child tests match callback.

Implementation

@override
Test? filter(bool Function(Test) callback) {
  if (callback(this)) {
    // filter() always returns new copies because they need to be attached
    // to their new parents.
    return clone();
  }

  return null;
}