TypeMatcher
.mirror_matchers.dart
library.2.2.0
.isA
as a replacement for instanceOf
.isA()
to create TypeMatcher
instances in a more fluent way.greaterThan
now compares with the >
operator rather not <
and not =
. This could cause tests which relied on this bug to start failing.Many improvements to TypeMatcher
Can now be used directly as const TypeMatcher<MyType>()
.
Added a type parameter to specify the target Type
.
name
constructor parameter optional and marked it deprecated. It's redundant to the type parameter.Migrated all isType
matchers to TypeMatcher
.
Added a having
function that allows chained validations of specific features of the target type.
/// Validates that the object is a [RangeError] with a message containing /// the string 'details' and `start` and `end` properties that are `null`. final _rangeMatcher = isRangeError .having((e) => e.message, 'message', contains('details')) .having((e) => e.start, 'start', isNull) .having((e) => e.end, 'end', isNull);
Deprecated the isInstanceOf
class. Use TypeMatcher
instead.
Improved the output of Matcher
instances that fail due to type errors.
Fixed unorderedMatches
in cases where the matchers may match more than one element and order of the elements doesn't line up with the order of the matchers.
Add containsAll matcher for Iterables. This Matcher checks that all values/matchers in an expected iterable are satisfied by an element in the value without allowing the same value to satisfy multiple matchers.
Make predicate
and pairwiseCompare
generic methods to allow typed functions to be passed to them as arguments.
Make internal implementations take better advantage of type promotion to avoid dynamic call overhead.
Fixed small documentation issues.
Fixed small issue in StringEqualsMatcher
.
Update to support future Dart language changes.
CustomMatcher
's feature throws.test
instead of unittest
pkg.Moved a number of members to the unittest
package.
TestFailure
, ErrorFormatter
, expect
, fail
, and ‘wrapAsync’.completes
, completion
, throws
, and throwsA
Matchers.Throws
class.throws...Error
Matchers.Removed FailureHandler
, DefaultFailureHandler
, configureExpectFailureHandler
, and getOrCreateExpectFailureHandler
. Now that expect
is in the unittest
package, these are no longer needed.
Removed the name
parameter for isInstanceOf
. This was previously deprecated, and is no longer necessary since all language implementations now support converting the type parameter to a string directly.
isInstanceOf
. All language implementations now support converting the type parameter to a string directly.equalsIgnoringWhitespace
.String
s containing characters that must be represented as escape sequences.isEmpty
and isNotEmpty
matchers and simply access the isEmpty
respectively isNotEmpty
fields. This allows them to work with custom collections. See Issue 21792 and Issue 21562prints
matcher test on dart2js.prints
matcher that matches output a callback emits via print
.isNotEmpty
matcher.Refactored libraries and tests.
Fixed spelling mistake.
isNaN
and isNotNaN
matchers.equals()
.@deprecated
annotation on matchers due to Issue 19173Matchers related to bad language use have been removed. These represent code structure that should rarely or never be validated in tests.
isAbstractClassInstantiationError
throwsAbstractClassInstantiationError
isFallThroughError
throwsFallThroughError
Added types to a number of method arguments.
The structure of the library and test code has been updated.