dart-lang / dart-lang/test

Allow failed matcher results to be tagged as errors

Open
#2,359 7 comments 0 reactions 0 assignees View on GitHub
package:matcher type-enhancement
Dominant language
Dart
Stars
536
Forks
232
Avg merge
1d 10h
Merged PRs (30d)
10

Description

Some Matchers typecheck for specific types that they know how to handle. Currently, they return false if it is not one of the expected types. This leads to undesirable behavior. For example, the following passes:
`expect(123, isNot(contains(2));`

It would be better for contains to throw when it receives anything other than an expected type. From what I can find, the other matchers that have this behavior are
- everyElement
- everything in string_matchers.dart
- everything in numeric_matchers.dart

Contributor guide

Open the contributing guide

Research direction

Start with contains and everyElement, then inspect string_matchers.dart and numeric_matchers.dart for matchers that return false after receiving an unsupported type. Trace the existing matcher result handling and tests to determine how failed results should be tagged as errors. Done means unsupported-type inputs no longer pass through negated matchers as ordinary mismatches.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.