From 55514cffe62d49287144c2c93499a6f053ff66dc Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 15 Oct 2024 23:18:58 +0000 Subject: [PATCH 1/4] Use a shorter doc header for CustomMatcher 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. --- CHANGELOG.md | 2 ++ lib/src/custom_matcher.dart | 4 +++- pubspec.yaml | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30d9ef6..d70ac51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.12.17-wip + ## 0.12.16+1 * Require Dart 3.0 diff --git a/lib/src/custom_matcher.dart b/lib/src/custom_matcher.dart index 4fd53e0..b0f2d6b 100644 --- a/lib/src/custom_matcher.dart +++ b/lib/src/custom_matcher.dart @@ -8,7 +8,9 @@ import 'description.dart'; import 'interfaces.dart'; import 'util.dart'; -/// A useful utility class for implementing other matchers through inheritance. +/// A base class for [Matcher] instances that match based on some feature of the +/// value under test. +/// /// Derived classes should call the base constructor with a feature name and /// description, and an instance matcher, and should implement the /// [featureValueOf] abstract method. diff --git a/pubspec.yaml b/pubspec.yaml index 8b6df88..9f5c036 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: matcher -version: 0.12.16+1 +version: 0.12.17 description: >- Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. @@ -19,3 +19,7 @@ dev_dependencies: fake_async: ^1.3.0 lints: ^3.0.0 test: ^1.23.0 + +dependency_overrides: + test: 1.25.0 + test_api: 0.7.3 From 09b7b7a47cb27b1359e504c5764b7645fbf2ca59 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 15 Oct 2024 23:29:24 +0000 Subject: [PATCH 2/4] Missed -wip --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9f5c036..90ce546 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: matcher -version: 0.12.17 +version: 0.12.17-wip description: >- Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. From 15286a6ba35c86d8ab627a8862c2e0ae2ec87901 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 15 Oct 2024 23:34:37 +0000 Subject: [PATCH 3/4] Bump min SDK to match test --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 2 ++ pubspec.yaml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0949abb..3f7ea76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [3.0, dev] + sdk: [3.4, dev] steps: - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 - uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 diff --git a/CHANGELOG.md b/CHANGELOG.md index d70ac51..afe767d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 0.12.17-wip +* Require Dart 3.4 + ## 0.12.16+1 * Require Dart 3.0 diff --git a/pubspec.yaml b/pubspec.yaml index 90ce546..938a18a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ description: >- repository: https://github.com/dart-lang/matcher environment: - sdk: ^3.0.0 + sdk: ^3.4.0 dependencies: async: ^2.10.0 From 9afd7c05d9bdebd4fe1cc47c7c06477d81dbcd96 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 15 Oct 2024 23:38:00 +0000 Subject: [PATCH 4/4] Remove some unnecessary cast and ! --- lib/src/expect/expect_async.dart | 2 +- lib/src/expect/future_matchers.dart | 6 +++--- lib/src/expect/throws_matcher.dart | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/expect/expect_async.dart b/lib/src/expect/expect_async.dart index 7571383..88cf6f2 100644 --- a/lib/src/expect/expect_async.dart +++ b/lib/src/expect/expect_async.dart @@ -203,7 +203,7 @@ class _ExpectedFunction { void _afterRun() { if (_complete) return; if (_minExpectedCalls > 0 && _actualCalls < _minExpectedCalls) return; - if (_isDone != null && !_isDone!()) return; + if (_isDone != null && !_isDone()) return; // Mark this callback as complete and remove it from the test case's // outstanding callback count; if that hits zero the test is done. diff --git a/lib/src/expect/future_matchers.dart b/lib/src/expect/future_matchers.dart index e1328b6..407b9b8 100644 --- a/lib/src/expect/future_matchers.dart +++ b/lib/src/expect/future_matchers.dart @@ -55,12 +55,12 @@ class _Completes extends AsyncMatcher { String? result; if (_matcher is AsyncMatcher) { - result = await (_matcher as AsyncMatcher).matchAsync(value) as String?; + result = await _matcher.matchAsync(value) as String?; if (result == null) return null; } else { var matchState = {}; - if (_matcher!.matches(value, matchState)) return null; - result = _matcher! + if (_matcher.matches(value, matchState)) return null; + result = _matcher .describeMismatch(value, StringDescription(), matchState, false) .toString(); } diff --git a/lib/src/expect/throws_matcher.dart b/lib/src/expect/throws_matcher.dart index 0ee3144..3a81821 100644 --- a/lib/src/expect/throws_matcher.dart +++ b/lib/src/expect/throws_matcher.dart @@ -121,9 +121,9 @@ class Throws extends AsyncMatcher { if (_matcher == null) return null; var matchState = {}; - if (_matcher!.matches(error, matchState)) return null; + if (_matcher.matches(error, matchState)) return null; - var result = _matcher! + var result = _matcher .describeMismatch(error, StringDescription(), matchState, false) .toString();