Chromium Code Reviews

Side by Side Diff: test/frontend/set_up_all_test.dart

Issue 2515303002: Add expectAsyncX and expectAsyncUntilX methods, and deprecate the old methods. (Closed)
Patch Set: Mark parameter types as Object. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « test/frontend/expect_async_test.dart ('k') | test/frontend/tear_down_all_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:async/async.dart'; 5 import 'package:async/async.dart';
6 import 'package:test/test.dart'; 6 import 'package:test/test.dart';
7 7
8 import '../utils.dart'; 8 import '../utils.dart';
9 9
10 void main() { 10 void main() {
(...skipping 186 matching lines...)
197 expect(setUpAll1Run, isTrue); 197 expect(setUpAll1Run, isTrue);
198 expect(setUpAll2Run, isTrue); 198 expect(setUpAll2Run, isTrue);
199 expect(setUpAll3Run, isTrue); 199 expect(setUpAll3Run, isTrue);
200 }); 200 });
201 }); 201 });
202 }); 202 });
203 }); 203 });
204 204
205 test("isn't run for a skipped group", () async { 205 test("isn't run for a skipped group", () async {
206 // Declare this in the outer test so if it runs, the outer test will fail. 206 // Declare this in the outer test so if it runs, the outer test will fail.
207 var shouldNotRun = expectAsync(() {}, count: 0); 207 var shouldNotRun = expectAsync0(() {}, count: 0);
208 208
209 var engine = declareEngine(() { 209 var engine = declareEngine(() {
210 group("skipped", () { 210 group("skipped", () {
211 setUpAll(shouldNotRun); 211 setUpAll(shouldNotRun);
212 212
213 test("test", () {}); 213 test("test", () {});
214 }, skip: true); 214 }, skip: true);
215 }); 215 });
216 216
217 await engine.run(); 217 await engine.run();
(...skipping 54 matching lines...)
272 // test list so that reporters don't display it as a passed test. 272 // test list so that reporters don't display it as a passed test.
273 expect(engine.liveTests, contains(setUpAllLiveTest)); 273 expect(engine.liveTests, contains(setUpAllLiveTest));
274 expect(engine.failed, contains(setUpAllLiveTest)); 274 expect(engine.failed, contains(setUpAllLiveTest));
275 expect(engine.passed, isNot(contains(setUpAllLiveTest))); 275 expect(engine.passed, isNot(contains(setUpAllLiveTest)));
276 expect(engine.skipped, isNot(contains(setUpAllLiveTest))); 276 expect(engine.skipped, isNot(contains(setUpAllLiveTest)));
277 expect(engine.active, isNot(contains(setUpAllLiveTest))); 277 expect(engine.active, isNot(contains(setUpAllLiveTest)));
278 }); 278 });
279 279
280 test("doesn't run tests in the group", () async { 280 test("doesn't run tests in the group", () async {
281 // Declare this in the outer test so if it runs, the outer test will fail. 281 // Declare this in the outer test so if it runs, the outer test will fail.
282 var shouldNotRun = expectAsync(() {}, count: 0); 282 var shouldNotRun = expectAsync0(() {}, count: 0);
283 283
284 var engine = declareEngine(() { 284 var engine = declareEngine(() {
285 setUpAll(() => throw "error"); 285 setUpAll(() => throw "error");
286 286
287 test("test", shouldNotRun); 287 test("test", shouldNotRun);
288 }); 288 });
289 289
290 expect(await engine.run(), isFalse); 290 expect(await engine.run(), isFalse);
291 }); 291 });
292 292
293 test("doesn't run inner groups", () async { 293 test("doesn't run inner groups", () async {
294 // Declare this in the outer test so if it runs, the outer test will fail. 294 // Declare this in the outer test so if it runs, the outer test will fail.
295 var shouldNotRun = expectAsync(() {}, count: 0); 295 var shouldNotRun = expectAsync0(() {}, count: 0);
296 296
297 var engine = declareEngine(() { 297 var engine = declareEngine(() {
298 setUpAll(() => throw "error"); 298 setUpAll(() => throw "error");
299 299
300 group("group", () { 300 group("group", () {
301 test("test", shouldNotRun); 301 test("test", shouldNotRun);
302 }); 302 });
303 }); 303 });
304 304
305 expect(await engine.run(), isFalse); 305 expect(await engine.run(), isFalse);
306 }); 306 });
307 307
308 test("doesn't run further setUpAlls", () async { 308 test("doesn't run further setUpAlls", () async {
309 // Declare this in the outer test so if it runs, the outer test will fail. 309 // Declare this in the outer test so if it runs, the outer test will fail.
310 var shouldNotRun = expectAsync(() {}, count: 0); 310 var shouldNotRun = expectAsync0(() {}, count: 0);
311 311
312 var engine = declareEngine(() { 312 var engine = declareEngine(() {
313 setUpAll(() => throw "error"); 313 setUpAll(() => throw "error");
314 setUpAll(shouldNotRun); 314 setUpAll(shouldNotRun);
315 315
316 test("test", shouldNotRun); 316 test("test", shouldNotRun);
317 }); 317 });
318 318
319 expect(await engine.run(), isFalse); 319 expect(await engine.run(), isFalse);
320 }); 320 });
321 }); 321 });
322 } 322 }
OLDNEW
« no previous file with comments | « test/frontend/expect_async_test.dart ('k') | test/frontend/tear_down_all_test.dart » ('j') | no next file with comments »

Powered by Google App Engine