OLD | NEW |
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 Loading... |
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); |
OLD | NEW |