Skip to content

Commit

Permalink
Latest build_web_compilers, move to pkg:lints, fix breaks (#605)
Browse files Browse the repository at this point in the history
Require Dart 2.18
  • Loading branch information
kevmoo committed Jan 30, 2023
1 parent 13340b5 commit d2a8df1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [stable, dev]
sdk: [2.18.0, dev]
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
Expand All @@ -45,7 +45,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, dev]
sdk: [2.18.0, dev]
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Require analyzer 5.2.0.
* Fix nice mocks generation in mixed mode (generated code is pre null-safety,
while mocked class is null-safe).
* Require Dart >= 2.17.0.
* Require Dart >= 2.18.0.
* Support typedef-aliased classes in `@GenerateMocks` and `@GenerateNiceMocks`

## 5.3.2
Expand Down
11 changes: 1 addition & 10 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
include: package:pedantic/analysis_options.yaml
include: package:lints/recommended.yaml
analyzer:
language:
strict-casts: true

linter:
rules:
# Errors
- comment_references
- control_flow_in_finally
- empty_statements
- hash_and_equals
- test_types_in_equals
- throw_in_finally

# Style
- await_only_futures
- camel_case_types
- non_constant_identifier_names
24 changes: 10 additions & 14 deletions lib/src/mock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,6 @@ typedef Answering<T> = T Function(Invocation realInvocation);

typedef Verification = VerificationResult Function<T>(T matchingInvocations);

typedef _InOrderVerification = List<VerificationResult> Function<T>(
List<T> recordedInvocations);

/// Verify that a method on a mock object was never called with the given
/// arguments.
///
Expand Down Expand Up @@ -1058,7 +1055,8 @@ Verification _makeVerify(bool never) {
/// given, but not that those were the only calls. In the example above, if
/// other calls were made to `eatFood` or `sound` between the three given
/// calls, or before or after them, the verification will still succeed.
_InOrderVerification get verifyInOrder {
List<VerificationResult> Function<T>(List<T> recordedInvocations)
get verifyInOrder {
if (_verifyCalls.isNotEmpty) {
throw StateError(_verifyCalls.join());
}
Expand Down Expand Up @@ -1113,7 +1111,7 @@ void verifyNoMoreInteractions(var mock) {
if (mock is Mock) {
var unverified = mock._realCalls.where((inv) => !inv.verified).toList();
if (unverified.isNotEmpty) {
fail('No more calls expected, but following found: ' + unverified.join());
fail('No more calls expected, but following found: ${unverified.join()}');
}
} else {
_throwMockArgumentError('verifyNoMoreInteractions', mock);
Expand All @@ -1123,8 +1121,8 @@ void verifyNoMoreInteractions(var mock) {
void verifyZeroInteractions(var mock) {
if (mock is Mock) {
if (mock._realCalls.isNotEmpty) {
fail('No interaction expected, but following found: ' +
mock._realCalls.join());
fail(
'No interaction expected, but following found: ${mock._realCalls.join()}');
}
} else {
_throwMockArgumentError('verifyZeroInteractions', mock);
Expand Down Expand Up @@ -1189,9 +1187,9 @@ void logInvocations(List<Mock> mocks) {
var allInvocations =
mocks.expand((m) => m._realCalls).toList(growable: false);
allInvocations.sort((inv1, inv2) => inv1.timeStamp.compareTo(inv2.timeStamp));
allInvocations.forEach((inv) {
for (var inv in allInvocations) {
print(inv.toString());
});
}
}

/// Reset the state of Mockito, typically for use between tests.
Expand Down Expand Up @@ -1227,10 +1225,8 @@ extension on Invocation {
if (args.any((arg) => arg.contains('\n'))) {
// As one or more arg contains newlines, put each on its own line, and
// indent each, for better readability.
argString = '\n' +
args
.map((arg) => arg.splitMapJoin('\n', onNonMatch: (m) => ' $m'))
.join(',\n');
argString =
'\n${args.map((arg) => arg.splitMapJoin('\n', onNonMatch: (m) => ' $m')).join(',\n')}';
} else {
// A compact String should be perfect.
argString = args.join(', ');
Expand All @@ -1255,7 +1251,7 @@ extension on Invocation {
if (isMethod) {
method = '$method($argString)';
} else if (isGetter) {
method = '$method';
method = method;
} else if (isSetter) {
method = '$method=$argString';
} else {
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >-
repository: https://github.com/dart-lang/mockito

environment:
sdk: '>=2.17.0-0 <3.0.0'
sdk: '>=2.18.0 <3.0.0'

dependencies:
analyzer: '>=5.2.0 <6.0.0'
Expand All @@ -23,8 +23,8 @@ dependencies:
dev_dependencies:
build_runner: ^2.0.0
build_test: ^2.0.0
build_web_compilers: ^3.0.0
build_web_compilers: '>=3.0.0 <5.0.0'
http: ^0.13.0
lints: ^2.0.0
package_config: '>=1.9.3 <3.0.0'
pedantic: ^1.10.0
test: ^1.16.0

0 comments on commit d2a8df1

Please sign in to comment.