You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are custom collections (like ListMultimap in quiver or RigidMap) that implement interfaces which are unknown to matcher. The matchers would be more useful and more easily understandable by removing all type checks from them:
This would be also match initial expectations. Obviously, there is a change in semantics (if the object has no isEmpty property, an exception will be thrown), but this is useful:
This also fixes the other bug (https://code.google.com/p/dart/issues/detail?id=21562) because isNot(isEmpty) on a null object would also throw an exception and fail the expect call instead of passing.
I'm happy to provide a patch for isEmpty (and isNotEmpty as soon as it is submitted).
Thanks,
Andreas
The text was updated successfully, but these errors were encountered:
This issue was originally filed by bl...@google.com
There are custom collections (like ListMultimap in quiver or RigidMap) that implement interfaces which are unknown to matcher. The matchers would be more useful and more easily understandable by removing all type checks from them:
class _Empty extends Matcher {
const _Empty();
bool matches(item, Map matchState) {
return item.isEmpty;
}
Description describe(Description description) => description.add('empty');
}
This would be also match initial expectations. Obviously, there is a change in semantics (if the object has no isEmpty property, an exception will be thrown), but this is useful:
This also fixes the other bug (https://code.google.com/p/dart/issues/detail?id=21562) because isNot(isEmpty) on a null object would also throw an exception and fail the expect call instead of passing.
I'm happy to provide a patch for isEmpty (and isNotEmpty as soon as it is submitted).
Thanks,
Andreas
The text was updated successfully, but these errors were encountered: