| 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:unittest/src/backend/declarer.dart'; | 7 import 'package:unittest/src/backend/declarer.dart'; |
| 8 import 'package:unittest/src/backend/suite.dart'; | 8 import 'package:unittest/src/backend/suite.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| 11 Declarer _declarer; | 11 Declarer _declarer; |
| 12 Suite _suite; | 12 Suite _suite; |
| 13 | 13 |
| 14 void main() { | 14 void main() { |
| 15 setUp(() { | 15 setUp(() { |
| 16 _declarer = new Declarer(); | 16 _declarer = new Declarer(); |
| 17 _suite = new Suite("suite", []); | 17 _suite = new Suite([]); |
| 18 }); | 18 }); |
| 19 | 19 |
| 20 group(".test()", () { | 20 group(".test()", () { |
| 21 test("declares a test with a description and body", () { | 21 test("declares a test with a description and body", () { |
| 22 var bodyRun = false; | 22 var bodyRun = false; |
| 23 _declarer.test("description", () { | 23 _declarer.test("description", () { |
| 24 bodyRun = true; | 24 bodyRun = true; |
| 25 }); | 25 }); |
| 26 | 26 |
| 27 expect(_declarer.tests, hasLength(1)); | 27 expect(_declarer.tests, hasLength(1)); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 /// Runs the test at [index] defined on [_declarer]. | 317 /// Runs the test at [index] defined on [_declarer]. |
| 318 /// | 318 /// |
| 319 /// This automatically sets up an `onError` listener to ensure that the test | 319 /// This automatically sets up an `onError` listener to ensure that the test |
| 320 /// doesn't throw any invisible exceptions. | 320 /// doesn't throw any invisible exceptions. |
| 321 Future _runTest(int index) { | 321 Future _runTest(int index) { |
| 322 var liveTest = _declarer.tests[index].load(_suite); | 322 var liveTest = _declarer.tests[index].load(_suite); |
| 323 liveTest.onError.listen(expectAsync((_) {}, | 323 liveTest.onError.listen(expectAsync((_) {}, |
| 324 count: 0, reason: "No errors expected for test #$index.")); | 324 count: 0, reason: "No errors expected for test #$index.")); |
| 325 return liveTest.run(); | 325 return liveTest.run(); |
| 326 } | 326 } |
| OLD | NEW |