Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit 53165f5

Browse files
authored
Use a shorter doc header for CustomMatcher (#256)
Separate the second sentence into a new paragraph so dartdoc does not pull it in to the header. Rephrase the header to say more than that it is a base class. Update language version to `3.4` to match the test runner. Remove some unnecessary cast and `!` from private field promotion.
1 parent 31f1358 commit 53165f5

File tree

7 files changed

+20
-10
lines changed

7 files changed

+20
-10
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [3.0, dev]
50+
sdk: [3.4, dev]
5151
steps:
5252
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
5353
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.12.17-wip
2+
3+
* Require Dart 3.4
4+
15
## 0.12.16+1
26

37
* Require Dart 3.0

lib/src/custom_matcher.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import 'description.dart';
88
import 'interfaces.dart';
99
import 'util.dart';
1010

11-
/// A useful utility class for implementing other matchers through inheritance.
11+
/// A base class for [Matcher] instances that match based on some feature of the
12+
/// value under test.
13+
///
1214
/// Derived classes should call the base constructor with a feature name and
1315
/// description, and an instance matcher, and should implement the
1416
/// [featureValueOf] abstract method.

lib/src/expect/expect_async.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class _ExpectedFunction<T> {
203203
void _afterRun() {
204204
if (_complete) return;
205205
if (_minExpectedCalls > 0 && _actualCalls < _minExpectedCalls) return;
206-
if (_isDone != null && !_isDone!()) return;
206+
if (_isDone != null && !_isDone()) return;
207207

208208
// Mark this callback as complete and remove it from the test case's
209209
// outstanding callback count; if that hits zero the test is done.

lib/src/expect/future_matchers.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ class _Completes extends AsyncMatcher {
5555

5656
String? result;
5757
if (_matcher is AsyncMatcher) {
58-
result = await (_matcher as AsyncMatcher).matchAsync(value) as String?;
58+
result = await _matcher.matchAsync(value) as String?;
5959
if (result == null) return null;
6060
} else {
6161
var matchState = {};
62-
if (_matcher!.matches(value, matchState)) return null;
63-
result = _matcher!
62+
if (_matcher.matches(value, matchState)) return null;
63+
result = _matcher
6464
.describeMismatch(value, StringDescription(), matchState, false)
6565
.toString();
6666
}

lib/src/expect/throws_matcher.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ class Throws extends AsyncMatcher {
121121
if (_matcher == null) return null;
122122

123123
var matchState = {};
124-
if (_matcher!.matches(error, matchState)) return null;
124+
if (_matcher.matches(error, matchState)) return null;
125125

126-
var result = _matcher!
126+
var result = _matcher
127127
.describeMismatch(error, StringDescription(), matchState, false)
128128
.toString();
129129

pubspec.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: matcher
2-
version: 0.12.16+1
2+
version: 0.12.17-wip
33
description: >-
44
Support for specifying test expectations via an extensible Matcher class.
55
Also includes a number of built-in Matcher implementations for common cases.
66
repository: https://github.com/dart-lang/matcher
77

88
environment:
9-
sdk: ^3.0.0
9+
sdk: ^3.4.0
1010

1111
dependencies:
1212
async: ^2.10.0
@@ -19,3 +19,7 @@ dev_dependencies:
1919
fake_async: ^1.3.0
2020
lints: ^3.0.0
2121
test: ^1.23.0
22+
23+
dependency_overrides:
24+
test: 1.25.0
25+
test_api: 0.7.3

0 commit comments

Comments
 (0)