@@ -66,23 +66,23 @@ void main() {
6666 expect (createRoute <String >(name: '/test' ), isRoute ());
6767 });
6868
69- test ('does not match anything that is not a route' , () {
70- expectToFail (
69+ test ('does not match anything that is not a route' , () async {
70+ await expectToFail (
7171 1 ,
7272 isRoute (),
7373 withMessage: 'is not a route but an instance of `int`' ,
7474 );
75- expectToFail (
75+ await expectToFail (
7676 'a' ,
7777 isRoute (),
7878 withMessage: 'is not a route but an instance of `String`' ,
7979 );
80- expectToFail (
80+ await expectToFail (
8181 null ,
8282 isRoute (),
8383 withMessage: 'is not a route but an instance of `Null`' ,
8484 );
85- expectToFail (
85+ await expectToFail (
8686 const SizedBox (),
8787 isRoute (),
8888 withMessage: 'is not a route but an instance of `SizedBox`' ,
@@ -96,23 +96,26 @@ void main() {
9696 expect (createRoute <String >(name: '/test' ), isRoute <String >());
9797 });
9898
99- test ('does not match anything that is not a route of that type' , () {
100- expectToFail (
101- createRoute <dynamic >(),
102- isRoute <String >(),
103- withMessage: 'is a route of type `dynamic` instead of `String`' ,
104- );
105- expectToFail (
106- createRoute <dynamic >(name: '/test' ),
107- isRoute <String >(),
108- withMessage: 'is a route of type `dynamic` instead of `String`' ,
109- );
110- expectToFail (
111- 1 ,
112- isRoute <String >(),
113- withMessage: 'is not a route but an instance of `int`' ,
114- );
115- });
99+ test (
100+ 'does not match anything that is not a route of that type' ,
101+ () async {
102+ await expectToFail (
103+ createRoute <dynamic >(),
104+ isRoute <String >(),
105+ withMessage: 'is a route of type `dynamic` instead of `String`' ,
106+ );
107+ await expectToFail (
108+ createRoute <dynamic >(name: '/test' ),
109+ isRoute <String >(),
110+ withMessage: 'is a route of type `dynamic` instead of `String`' ,
111+ );
112+ await expectToFail (
113+ 1 ,
114+ isRoute <String >(),
115+ withMessage: 'is not a route but an instance of `int`' ,
116+ );
117+ },
118+ );
116119 });
117120
118121 group ('with whereSettings argument' , () {
@@ -134,14 +137,14 @@ void main() {
134137 });
135138
136139 test ('does not match anything that is not a route '
137- 'with matching settings' , () {
138- expectToFail (
140+ 'with matching settings' , () async {
141+ await expectToFail (
139142 createRoute <dynamic >(name: '/test' ),
140143 isRoute (whereSettings: equalsSettingsOf (createRoute <String >())),
141144 withMessage:
142145 "is a route where `settings` has `name` with value '/test'" ,
143146 );
144- expectToFail (
147+ await expectToFail (
145148 createRoute <dynamic >(name: '/other_name' ),
146149 isRoute (
147150 whereSettings: equalsSettingsOf (
@@ -155,7 +158,7 @@ is a route where `settings` has `name` with value '/other_name' which is differe
155158 ^
156159 Differ at offset 1''' ,
157160 );
158- expectToFail (
161+ await expectToFail (
159162 1 ,
160163 isRoute (whereSettings: equalsSettingsOf (createRoute <dynamic >())),
161164 withMessage: 'is not a route but an instance of `int`' ,
@@ -175,29 +178,32 @@ is a route where `settings` has `name` with value '/other_name' which is differe
175178 );
176179 });
177180
178- test ('does not match anything that is not a route with that name' , () {
179- expectToFail (
180- createRoute <dynamic >(),
181- isRoute (whereName: equals ('/test' )),
182- withMessage:
183- "is a route where the route's `name` is empty instead of '/test'" ,
184- );
185- expectToFail (
186- createRoute <dynamic >(name: '/other_name' ),
187- isRoute (whereName: equals ('/test' )),
188- withMessage: '''
181+ test (
182+ 'does not match anything that is not a route with that name' ,
183+ () async {
184+ await expectToFail (
185+ createRoute <dynamic >(),
186+ isRoute (whereName: equals ('/test' )),
187+ withMessage:
188+ "is a route where the route's `name` is empty instead of '/test'" ,
189+ );
190+ await expectToFail (
191+ createRoute <dynamic >(name: '/other_name' ),
192+ isRoute (whereName: equals ('/test' )),
193+ withMessage: '''
189194is a route where the route's `name` is different.
190195 Expected: /test
191196 Actual: /other_name ...
192197 ^
193198 Differ at offset 1''' ,
194- );
195- expectToFail (
196- 1 ,
197- isRoute (whereName: equals ('/test' )),
198- withMessage: 'is not a route but an instance of `int`' ,
199- );
200- });
199+ );
200+ await expectToFail (
201+ 1 ,
202+ isRoute (whereName: equals ('/test' )),
203+ withMessage: 'is not a route but an instance of `int`' ,
204+ );
205+ },
206+ );
201207 });
202208
203209 group ('with whereArguments argument' , () {
@@ -214,22 +220,22 @@ is a route where the route's `name` is different.
214220
215221 test (
216222 'does not match anything that is not a route with same arguments' ,
217- () {
218- expectToFail (
223+ () async {
224+ await expectToFail (
219225 createRoute <dynamic >(arguments: {'a' : 1 }),
220226 isRoute (whereArguments: equals ({'a' : 2 })),
221227 withMessage:
222228 "is a route where the route's `arguments` "
223229 "at location ['a'] is <1> instead of <2>" ,
224230 );
225- expectToFail (
231+ await expectToFail (
226232 createRoute <dynamic >(arguments: {'a' : 1 }),
227233 isRoute (whereArguments: equals ({'b' : 1 })),
228234 withMessage:
229235 "is a route where the route's `arguments` "
230236 "is missing map key 'b'" ,
231237 );
232- expectToFail (
238+ await expectToFail (
233239 1 ,
234240 isRoute (whereArguments: equals ({'a' : 1 })),
235241 withMessage: 'is not a route but an instance of `int`' ,
@@ -244,23 +250,23 @@ is a route where the route's `name` is different.
244250 });
245251
246252 test ('does not match anything that is not a route with matching '
247- 'maintainState argument' , () {
248- expectToFail (
253+ 'maintainState argument' , () async {
254+ await expectToFail (
249255 createRoute <dynamic >(),
250256 isRoute (whereMaintainState: isFalse),
251257 withMessage:
252258 'is a route where `maintainState` '
253259 'is true instead of false' ,
254260 );
255- expectToFail (
261+ await expectToFail (
256262 NonModalRoute (),
257263 isRoute (whereMaintainState: isTrue),
258264 withMessage:
259265 'is a route where `maintainState` '
260266 'is not a property on `NonModalRoute` and can only be used '
261267 'with `ModalRoute`s' ,
262268 );
263- expectToFail (
269+ await expectToFail (
264270 1 ,
265271 isRoute (whereMaintainState: isTrue),
266272 withMessage: 'is not a route but an instance of `int`' ,
@@ -276,33 +282,36 @@ is a route where the route's `name` is different.
276282 );
277283 });
278284
279- test ('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:
285- 'is a route where `fullscreenDialog` '
286- 'is true instead of false' ,
287- );
288- expectToFail (
289- NonModalRoute (),
290- isRoute (whereFullscreenDialog: isFalse),
291- withMessage:
292- 'is a route where `fullscreenDialog` '
293- 'is not a property on `NonModalRoute` and can only be used '
294- 'with `PageRoute`s' ,
295- );
296- expectToFail (
297- 1 ,
298- isRoute (whereFullscreenDialog: isTrue),
299- withMessage: 'is not a route but an instance of `int`' ,
300- );
301- });
285+ test (
286+ 'does not match anything that is not a route with matching '
287+ 'fullscreenDialog argument' ,
288+ () async {
289+ await expectToFail (
290+ createRoute <dynamic >(fullscreenDialog: true ),
291+ isRoute (whereFullscreenDialog: isFalse),
292+ withMessage:
293+ 'is a route where `fullscreenDialog` '
294+ 'is true instead of false' ,
295+ );
296+ await expectToFail (
297+ NonModalRoute (),
298+ isRoute (whereFullscreenDialog: isFalse),
299+ withMessage:
300+ 'is a route where `fullscreenDialog` '
301+ 'is not a property on `NonModalRoute` and can only be used '
302+ 'with `PageRoute`s' ,
303+ );
304+ await expectToFail (
305+ 1 ,
306+ isRoute (whereFullscreenDialog: isTrue),
307+ withMessage: 'is not a route but an instance of `int`' ,
308+ );
309+ },
310+ );
302311 });
303312
304- test ('returns all relevant mismatches in one log' , () {
305- expectToFail (
313+ test ('returns all relevant mismatches in one log' , () async {
314+ await expectToFail (
306315 createRoute <dynamic >(
307316 name: '/other_name' ,
308317 arguments: {'b' : 1 },
0 commit comments