Skip to content

Commit

Permalink
refactor(mocktail): upgrade analysis_options.yaml (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Jun 12, 2024
1 parent 8a7bd29 commit 80a8db5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ linter:
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
- no_runtimeType_toString
- no_wildcard_variable_uses
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
Expand Down Expand Up @@ -153,6 +154,7 @@ linter:
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
Expand Down
32 changes: 16 additions & 16 deletions packages/mocktail/lib/src/mocktail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ When<T> Function<T>(T Function() x) get when {
throw StateError('Cannot call `when` within a stub response');
}
_whenInProgress = true;
return <T>(T Function() _) {
return <T>(T Function() fn) {
try {
_();
} catch (_) {
if (_ is! TypeError) rethrow;
fn();
} catch (e) {
if (e is! TypeError) rethrow;
}
_whenInProgress = false;
return When<T>();
Expand Down Expand Up @@ -395,12 +395,12 @@ List<VerificationResult> Function<T>(
throw StateError(_verifyCalls.join());
}
_verificationInProgress = true;
return <T>(List<T Function()> _) {
for (final invocation in _) {
return <T>(List<T Function()> invocations) {
for (final invocation in invocations) {
try {
invocation();
} catch (_) {
if (_ is! TypeError) rethrow;
} catch (e) {
if (e is! TypeError) rethrow;
}
}

Expand Down Expand Up @@ -503,11 +503,11 @@ Verify _makeVerify(bool never) {
);
}
_verificationInProgress = true;
return <T>(T Function() mock) {
return <T>(T Function() fn) {
try {
mock();
} catch (_) {
if (_ is! TypeError) rethrow;
fn();
} catch (e) {
if (e is! TypeError) rethrow;
}
_verificationInProgress = false;
if (_verifyCalls.length == 1) {
Expand Down Expand Up @@ -758,11 +758,11 @@ class _VerifyCall {
/// future will return immediately.
Future<Invocation> Function<T>(T Function() _) get untilCalled {
_untilCalledInProgress = true;
return <T>(T Function() _) {
return <T>(T Function() fn) {
try {
_();
} catch (_) {
if (_ is! TypeError) rethrow;
fn();
} catch (e) {
if (e is! TypeError) rethrow;
}
_untilCalledInProgress = false;
return _untilCall!.invocationFuture;
Expand Down

0 comments on commit 80a8db5

Please sign in to comment.