| 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/invoker.dart'; | 8 import 'package:unittest/src/invoker.dart'; |
| 9 import 'package:unittest/src/state.dart'; | 9 import 'package:unittest/src/state.dart'; |
| 10 import 'package:unittest/src/suite.dart'; | 10 import 'package:unittest/src/suite.dart'; |
| 11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 12 | 12 |
| 13 import 'utils.dart'; | 13 import 'utils.dart'; |
| 14 | 14 |
| 15 void main() { | 15 void main() { |
| 16 var suite; | 16 var suite; |
| 17 setUp(() { | 17 setUp(() { |
| 18 lastState = null; | 18 lastState = null; |
| 19 suite = new Suite("suite", []); | 19 suite = new Suite("suite", []); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 group("Invoker.current", () { | 22 group("Invoker.current", () { |
| 23 var invoker = Invoker.current; |
| 23 test("returns null outside of a test body", () { | 24 test("returns null outside of a test body", () { |
| 24 expect(Invoker.current, isNull); | 25 expect(invoker, isNull); |
| 25 }); | 26 }); |
| 26 | 27 |
| 27 test("returns the current invoker in a test body", () { | 28 test("returns the current invoker in a test body", () { |
| 28 var invoker; | 29 var invoker; |
| 29 var liveTest = new LocalTest("test", () { | 30 var liveTest = new LocalTest("test", () { |
| 30 invoker = Invoker.current; | 31 invoker = Invoker.current; |
| 31 }).load(suite); | 32 }).load(suite); |
| 32 liveTest.onError.listen(expectAsync((_) {}, count: 0)); | 33 liveTest.onError.listen(expectAsync((_) {}, count: 0)); |
| 33 | 34 |
| 34 return liveTest.run().then((_) { | 35 return liveTest.run().then((_) { |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 expectErrors(liveTest, [(error) { | 486 expectErrors(liveTest, [(error) { |
| 486 expect(lastState.status, equals(Status.complete)); | 487 expect(lastState.status, equals(Status.complete)); |
| 487 expect(error, new isInstanceOf<TimeoutException>()); | 488 expect(error, new isInstanceOf<TimeoutException>()); |
| 488 }]); | 489 }]); |
| 489 | 490 |
| 490 liveTest.run(); | 491 liveTest.run(); |
| 491 async.elapse(new Duration(seconds: 30)); | 492 async.elapse(new Duration(seconds: 30)); |
| 492 }); | 493 }); |
| 493 }); | 494 }); |
| 494 } | 495 } |
| OLD | NEW |