Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: test/backend/invoker_test.dart

Issue 1044953004: Gracefully handle tests that print. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/runner/vm/isolate_test.dart ('k') | test/runner/browser/runner_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 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:fake_async/fake_async.dart'; 7 import 'package:fake_async/fake_async.dart';
8 import 'package:unittest/src/backend/invoker.dart'; 8 import 'package:unittest/src/backend/invoker.dart';
9 import 'package:unittest/src/backend/metadata.dart'; 9 import 'package:unittest/src/backend/metadata.dart';
10 import 'package:unittest/src/backend/state.dart'; 10 import 'package:unittest/src/backend/state.dart';
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 486
487 expectErrors(liveTest, [(error) { 487 expectErrors(liveTest, [(error) {
488 expect(lastState.status, equals(Status.complete)); 488 expect(lastState.status, equals(Status.complete));
489 expect(error, new isInstanceOf<TimeoutException>()); 489 expect(error, new isInstanceOf<TimeoutException>());
490 }]); 490 }]);
491 491
492 liveTest.run(); 492 liveTest.run();
493 async.elapse(new Duration(seconds: 30)); 493 async.elapse(new Duration(seconds: 30));
494 }); 494 });
495 }); 495 });
496
497 test("a test's prints are captured and reported", () {
498 expect(() {
499 var liveTest = _localTest(() {
500 print("Hello,");
501 return new Future(() => print("world!"));
502 }).load(suite);
503
504 expect(liveTest.onPrint.take(2).toList(),
505 completion(equals(["Hello,", "world!"])));
506
507 return liveTest.run();
508 }, prints(isEmpty));
509 });
496 } 510 }
497 511
498 LocalTest _localTest(body(), {tearDown()}) => 512 LocalTest _localTest(body(), {tearDown()}) =>
499 new LocalTest("test", new Metadata(), body, tearDown: tearDown); 513 new LocalTest("test", new Metadata(), body, tearDown: tearDown);
OLDNEW
« no previous file with comments | « lib/src/runner/vm/isolate_test.dart ('k') | test/runner/browser/runner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698