| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library unittestTest; | 5 library unittestTest; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 part 'unittest_test_utils.dart'; | 10 part 'unittest_test_utils.dart'; |
| 11 | 11 |
| 12 var testName = 'async setup teardown test'; | 12 var testName = 'async setup teardown test'; |
| 13 | 13 |
| 14 var testFunction = (_) { | 14 var testFunction = (_) { |
| 15 group('good setup/good teardown', () { | 15 group('good setup/good teardown', () { |
| 16 setUp(() { | 16 setUp(() { |
| 17 return new Future.value(0); | 17 return new Future.value(0); |
| 18 }); | 18 }); |
| 19 tearDown(() { | 19 tearDown(() { |
| 20 return new Future.value(0); | 20 return new Future.value(0); |
| 21 }); | 21 }); |
| 22 test('foo1', () {}); | 22 test('foo1', (){}); |
| 23 }); | 23 }); |
| 24 group('good setup/bad teardown', () { | 24 group('good setup/bad teardown', () { |
| 25 setUp(() { | 25 setUp(() { |
| 26 return new Future.value(0); | 26 return new Future.value(0); |
| 27 }); | 27 }); |
| 28 tearDown(() { | 28 tearDown(() { |
| 29 return new Future.error("Failed to complete tearDown"); | 29 return new Future.error("Failed to complete tearDown"); |
| 30 }); | 30 }); |
| 31 test('foo2', () {}); | 31 test('foo2', (){}); |
| 32 }); | 32 }); |
| 33 group('bad setup/good teardown', () { | 33 group('bad setup/good teardown', () { |
| 34 setUp(() { | 34 setUp(() { |
| 35 return new Future.error("Failed to complete setUp"); | 35 return new Future.error("Failed to complete setUp"); |
| 36 }); | 36 }); |
| 37 tearDown(() { | 37 tearDown(() { |
| 38 return new Future.value(0); | 38 return new Future.value(0); |
| 39 }); | 39 }); |
| 40 test('foo3', () {}); | 40 test('foo3', (){}); |
| 41 }); | 41 }); |
| 42 group('bad setup/bad teardown', () { | 42 group('bad setup/bad teardown', () { |
| 43 setUp(() { | 43 setUp(() { |
| 44 return new Future.error("Failed to complete setUp"); | 44 return new Future.error("Failed to complete setUp"); |
| 45 }); | 45 }); |
| 46 tearDown(() { | 46 tearDown(() { |
| 47 return new Future.error("Failed to complete tearDown"); | 47 return new Future.error("Failed to complete tearDown"); |
| 48 }); | 48 }); |
| 49 test('foo4', () {}); | 49 test('foo4', (){}); |
| 50 }); | 50 }); |
| 51 // The next test is just to make sure we make steady progress | 51 // The next test is just to make sure we make steady progress |
| 52 // through the tests. | 52 // through the tests. |
| 53 test('post groups', () {}); | 53 test('post groups', () {}); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 var expected = buildStatusString(2, 0, 3, | 56 var expected = buildStatusString(2, 0, 3, |
| 57 'good setup/good teardown foo1::' | 57 'good setup/good teardown foo1::' |
| 58 'good setup/bad teardown foo2:' | 58 'good setup/bad teardown foo2:' |
| 59 'Teardown failed: Caught Failed to complete tearDown:' | 59 'Teardown failed: Caught Failed to complete tearDown:' |
| 60 'bad setup/good teardown foo3:' | 60 'bad setup/good teardown foo3:' |
| 61 'Setup failed: Caught Failed to complete setUp:' | 61 'Setup failed: Caught Failed to complete setUp:' |
| 62 'bad setup/bad teardown foo4:' | 62 'bad setup/bad teardown foo4:' |
| 63 'Setup failed: Caught Failed to complete setUp:' | 63 'Setup failed: Caught Failed to complete setUp:' |
| 64 'post groups'); | 64 'post groups'); |
| OLD | NEW |