matcher 0.12.4

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 92

Support for specifying test expectations, such as for unit tests.

The matcher library provides a third-generation assertion mechanism, drawing inspiration from Hamcrest.

For more information, see Unit Testing with Dart.

0.12.4

  • Add isCastError.

0.12.3+1

  • Set max SDK version to <3.0.0, and adjusted other dependencies.

0.12.3

  • Many improvements to TypeMatcher

    • Can now be used directly as const TypeMatcher<MyType>().

    • Added a type parameter to specify the target Type.

      • Made the 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.

0.12.2+1

  • Updated SDK version to 2.0.0-dev.17.0

0.12.2

  • 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.

0.12.1+4

  • Fixed SDK constraint to allow edge builds.

0.12.1+3

  • 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.

0.12.1+2

  • Fixed small documentation issues.

  • Fixed small issue in StringEqualsMatcher.

  • Update to support future Dart language changes.

0.12.1+1

  • Produce a better error message when a CustomMatcher's feature throws.

0.12.1

  • Add containsAllInOrder matcher for Iterables

0.12.0+2

  • Fix all strong-mode warnings.

0.12.0+1

  • Fix test files to use test instead of unittest pkg.

0.12.0

  • Moved a number of members to the unittest package.

    • TestFailure, ErrorFormatter, expect, fail, and 'wrapAsync'.
    • completes, completion, throws, and throwsA Matchers.
    • The Throws class.
    • All of the 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.

0.11.4+6

  • Fix a bug introduced in 0.11.4+5 in which operator matchers broke when taking lists of matchers.

0.11.4+5

  • Fix all strong-mode warnings.

0.11.4+4

  • Deprecate the name parameter to isInstanceOf. All language implementations now support converting the type parameter to a string directly.

0.11.4+3

  • Fix the examples for equalsIgnoringWhitespace.

0.11.4+2

  • Improve the formatting of strings that contain unprintable ASCII characters.

0.11.4+1

  • Correctly match and print Strings containing characters that must be represented as escape sequences.

0.11.4

  • Remove the type checks in the 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 21562

0.11.3+1

  • Fix the prints matcher test on dart2js.

0.11.3

  • Add a prints matcher that matches output a callback emits via print.

0.11.2

  • Add an isNotEmpty matcher.

0.11.1+1

  • Refactored libraries and tests.

  • Fixed spelling mistake.

0.11.1

  • Added isNaN and isNotNaN matchers.

0.11.0

  • Removed deprecated matchers.

0.10.1+1

  • Get the tests passing when run on dart2js in minified mode.

0.10.1

  • Compare sets order-independently when using equals().

0.10.0+3

  • Removed @deprecated annotation on matchers due to Issue 19173

0.10.0+2

  • Added types to a number of constants.

0.10.0+1

  • Matchers 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.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  matcher: ^0.12.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:matcher/matcher.dart';
  
Version Uploaded Documentation Archive
0.12.4 Jul 17, 2018 Go to the documentation of matcher 0.12.4 Download matcher 0.12.4 archive
0.12.3+1 Jul 16, 2018 Go to the documentation of matcher 0.12.3+1 Download matcher 0.12.3+1 archive
0.12.3 Jun 14, 2018 Go to the documentation of matcher 0.12.3 Download matcher 0.12.3 archive
0.12.2+1 May 3, 2018 Go to the documentation of matcher 0.12.2+1 Download matcher 0.12.2+1 archive
0.12.2 Apr 12, 2018 Go to the documentation of matcher 0.12.2 Download matcher 0.12.2 archive
0.12.1+4 Sep 20, 2017 Go to the documentation of matcher 0.12.1+4 Download matcher 0.12.1+4 archive
0.12.1+3 Sep 5, 2017 Go to the documentation of matcher 0.12.1+3 Download matcher 0.12.1+3 archive
0.12.1+2 Aug 30, 2017 Go to the documentation of matcher 0.12.1+2 Download matcher 0.12.1+2 archive
0.12.1+1 May 27, 2017 Go to the documentation of matcher 0.12.1+1 Download matcher 0.12.1+1 archive
0.12.1 May 5, 2017 Go to the documentation of matcher 0.12.1 Download matcher 0.12.1 archive

All 31 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
95
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
92
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:matcher/matcher.dart.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use matcher.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.17.0 <3.0.0
stack_trace ^1.2.0 1.9.3
Transitive dependencies
path 1.6.2
Dev dependencies
test >=0.12.0 <2.0.0