Skip to content

Commit a147b63

Browse files
pietroidalestiagowolfenrain
authored
chore: bumping very good analysis from 6.0.0 to 7.0.0 (#87)
* chore: bumping very good analysis * Update lib/src/matchers.dart Co-authored-by: Alejandro Santiago <[email protected]> * Update test/src/matchers_test.dart Co-authored-by: Alejandro Santiago <[email protected]> * Update test/src/matchers_test.dart Co-authored-by: Alejandro Santiago <[email protected]> * Update lib/src/matchers.dart Co-authored-by: Jochum van der Ploeg <[email protected]> * updating analysis --------- Co-authored-by: Alejandro Santiago <[email protected]> Co-authored-by: Jochum van der Ploeg <[email protected]>
1 parent 95b7bd0 commit a147b63

File tree

6 files changed

+92
-105
lines changed

6 files changed

+92
-105
lines changed

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:very_good_analysis/analysis_options.6.0.0.yaml
1+
include: package:very_good_analysis/analysis_options.7.0.0.yaml

lib/mockingjay.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// A package that makes it easy to mock, test and verify
22
/// navigation calls in Flutter.
3-
library mockingjay;
3+
library;
44

55
export 'package:mocktail/mocktail.dart';
66

lib/src/matchers.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ Matcher isRoute<T extends Object?>({
4141
/// Returns a matcher that matches the [RouteSettings] from the given [route].
4242
Matcher equalsSettingsOf(Route<dynamic> route) {
4343
return isA<RouteSettings>()
44-
.having(
45-
(s) => s.name,
46-
'name',
47-
equals(route.settings.name),
48-
)
44+
.having((s) => s.name, 'name', equals(route.settings.name))
4945
.having(
5046
(s) => s.arguments,
5147
'arguments',
@@ -87,8 +83,8 @@ class _RouteMatcher<T> extends Matcher {
8783
hasMaintainStateMatcher ||
8884
hasFullscreenDialogMatcher;
8985

90-
/// Takes an [input] string that looks like "FooBarRoute<MyType>" and extracts
91-
/// the part "MyType".
86+
/// Takes an [input] string that looks like `FooBarRoute<MyType>` and extracts
87+
/// the part `MyType`.
9288
///
9389
/// If the `Route<` part cannot be found, it returns the input string
9490
/// unchaged.
@@ -192,8 +188,10 @@ class _RouteMatcher<T> extends Matcher {
192188
whereMaintainState!.matches(item.maintainState, matchState));
193189
final fullscreenDialogMatches = !hasFullscreenDialogMatcher ||
194190
(item is PageRoute &&
195-
whereFullscreenDialog!
196-
.matches(item.fullscreenDialog, matchState));
191+
whereFullscreenDialog!.matches(
192+
item.fullscreenDialog,
193+
matchState,
194+
));
197195

198196
return typeMatches &&
199197
settingsMatches &&

lib/src/mock_navigator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class _MockMaterialPageRoute extends MaterialPageRoute<void> {
1717
// By the time the setState is called, the attribute is already set
1818
// so we just ignore the error and the hack will do its job.
1919
state.insert(entry);
20-
} catch (_) {}
20+
} on Object catch (_) {}
2121
// Set mounted back to false to make sure the state doesn't get
2222
// marked as dirty during OverlayEntry.remove().
2323
state._mounted = false;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ dependencies:
1717
test: ^1.25.7
1818

1919
dev_dependencies:
20-
very_good_analysis: ^6.0.0
20+
very_good_analysis: ^7.0.0

test/src/matchers_test.dart

Lines changed: 81 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ void main() {
3737
bool fullscreenDialog = false,
3838
}) {
3939
return MaterialPageRoute<T>(
40-
settings: RouteSettings(
41-
name: name,
42-
arguments: arguments,
43-
),
40+
settings: RouteSettings(name: name, arguments: arguments),
4441
maintainState: maintainState,
4542
fullscreenDialog: fullscreenDialog,
4643
builder: (_) => const SizedBox(),
@@ -49,19 +46,17 @@ void main() {
4946

5047
group('constructor', () {
5148
test(
52-
'throws AssertionError when both whereSettings '
53-
'and whereName or whereArguments matchers are provided',
54-
() {
55-
expect(
56-
() => isRoute(
57-
whereSettings: isNotNull,
58-
whereName: isNotNull,
59-
whereArguments: isNotNull,
60-
),
61-
throwsAssertionError,
62-
);
63-
},
64-
);
49+
'throws AssertionError when both whereSettings '
50+
'and whereName or whereArguments matchers are provided', () {
51+
expect(
52+
() => isRoute(
53+
whereSettings: isNotNull,
54+
whereName: isNotNull,
55+
whereArguments: isNotNull,
56+
),
57+
throwsAssertionError,
58+
);
59+
});
6560
});
6661

6762
group('without arguments', () {
@@ -130,43 +125,44 @@ void main() {
130125
expect(
131126
createRoute<dynamic>(name: '/test'),
132127
isRoute(
133-
whereSettings:
134-
isA<RouteSettings>().having((s) => s.name, 'name', '/test'),
128+
whereSettings: isA<RouteSettings>().having(
129+
(s) => s.name,
130+
'name',
131+
'/test',
132+
),
135133
),
136134
);
137135
});
138136

139137
test(
140-
'does not match anything that is not a route '
141-
'with matching settings',
142-
() {
143-
expectToFail(
144-
createRoute<dynamic>(name: '/test'),
145-
isRoute(whereSettings: equalsSettingsOf(createRoute<String>())),
146-
withMessage:
147-
"is a route where `settings` has `name` with value '/test'",
148-
);
149-
expectToFail(
150-
createRoute<dynamic>(name: '/other_name'),
151-
isRoute(
152-
whereSettings: equalsSettingsOf(
153-
createRoute<dynamic>(name: '/test'),
154-
),
138+
'does not match anything that is not a route '
139+
'with matching settings', () {
140+
expectToFail(
141+
createRoute<dynamic>(name: '/test'),
142+
isRoute(whereSettings: equalsSettingsOf(createRoute<String>())),
143+
withMessage:
144+
"is a route where `settings` has `name` with value '/test'",
145+
);
146+
expectToFail(
147+
createRoute<dynamic>(name: '/other_name'),
148+
isRoute(
149+
whereSettings: equalsSettingsOf(
150+
createRoute<dynamic>(name: '/test'),
155151
),
156-
withMessage: '''
152+
),
153+
withMessage: '''
157154
is a route where `settings` has `name` with value '/other_name' which is different.
158155
Expected: /test
159156
Actual: /other_name ...
160157
^
161158
Differ at offset 1''',
162-
);
163-
expectToFail(
164-
1,
165-
isRoute(whereSettings: equalsSettingsOf(createRoute<dynamic>())),
166-
withMessage: 'is not a route but an instance of `int`',
167-
);
168-
},
169-
);
159+
);
160+
expectToFail(
161+
1,
162+
isRoute(whereSettings: equalsSettingsOf(createRoute<dynamic>())),
163+
withMessage: 'is not a route but an instance of `int`',
164+
);
165+
});
170166
});
171167

172168
group('with whereName argument', () {
@@ -244,36 +240,31 @@ is a route where the route's `name` is different.
244240

245241
group('with whereMaintainState argument', () {
246242
test('matches any route with matching maintainState argument', () {
247-
expect(
243+
expect(createRoute<dynamic>(), isRoute(whereMaintainState: isTrue));
244+
});
245+
246+
test(
247+
'does not match anything that is not a route with matching '
248+
'maintainState argument', () {
249+
expectToFail(
248250
createRoute<dynamic>(),
251+
isRoute(whereMaintainState: isFalse),
252+
withMessage: 'is a route where `maintainState` '
253+
'is true instead of false',
254+
);
255+
expectToFail(
256+
NonModalRoute(),
249257
isRoute(whereMaintainState: isTrue),
258+
withMessage: 'is a route where `maintainState` '
259+
'is not a property on `NonModalRoute` and can only be used '
260+
'with `ModalRoute`s',
261+
);
262+
expectToFail(
263+
1,
264+
isRoute(whereMaintainState: isTrue),
265+
withMessage: 'is not a route but an instance of `int`',
250266
);
251267
});
252-
253-
test(
254-
'does not match anything that is not a route with matching '
255-
'maintainState argument',
256-
() {
257-
expectToFail(
258-
createRoute<dynamic>(),
259-
isRoute(whereMaintainState: isFalse),
260-
withMessage: 'is a route where `maintainState` '
261-
'is true instead of false',
262-
);
263-
expectToFail(
264-
NonModalRoute(),
265-
isRoute(whereMaintainState: isTrue),
266-
withMessage: 'is a route where `maintainState` '
267-
'is not a property on `NonModalRoute` and can only be used '
268-
'with `ModalRoute`s',
269-
);
270-
expectToFail(
271-
1,
272-
isRoute(whereMaintainState: isTrue),
273-
withMessage: 'is not a route but an instance of `int`',
274-
);
275-
},
276-
);
277268
});
278269

279270
group('with whereFullscreenDialog argument', () {
@@ -285,29 +276,27 @@ is a route where the route's `name` is different.
285276
});
286277

287278
test(
288-
'does not match anything that is not a route with matching '
289-
'fullscreenDialog argument',
290-
() {
291-
expectToFail(
292-
createRoute<dynamic>(fullscreenDialog: true),
293-
isRoute(whereFullscreenDialog: isFalse),
294-
withMessage: 'is a route where `fullscreenDialog` '
295-
'is true instead of false',
296-
);
297-
expectToFail(
298-
NonModalRoute(),
299-
isRoute(whereFullscreenDialog: isFalse),
300-
withMessage: 'is a route where `fullscreenDialog` '
301-
'is not a property on `NonModalRoute` and can only be used '
302-
'with `PageRoute`s',
303-
);
304-
expectToFail(
305-
1,
306-
isRoute(whereFullscreenDialog: isTrue),
307-
withMessage: 'is not a route but an instance of `int`',
308-
);
309-
},
310-
);
279+
'does not match anything that is not a route with matching '
280+
'fullscreenDialog argument', () {
281+
expectToFail(
282+
createRoute<dynamic>(fullscreenDialog: true),
283+
isRoute(whereFullscreenDialog: isFalse),
284+
withMessage: 'is a route where `fullscreenDialog` '
285+
'is true instead of false',
286+
);
287+
expectToFail(
288+
NonModalRoute(),
289+
isRoute(whereFullscreenDialog: isFalse),
290+
withMessage: 'is a route where `fullscreenDialog` '
291+
'is not a property on `NonModalRoute` and can only be used '
292+
'with `PageRoute`s',
293+
);
294+
expectToFail(
295+
1,
296+
isRoute(whereFullscreenDialog: isTrue),
297+
withMessage: 'is not a route but an instance of `int`',
298+
);
299+
});
311300
});
312301

313302
test('returns all relevant mismatches in one log', () {

0 commit comments

Comments
 (0)