Chromium Code Reviews| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
| 9 | 9 |
| 10 import '../metatest.dart'; | 10 import '../metatest.dart'; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 onExceptionRun = true; | 72 onExceptionRun = true; |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 if (!onExceptionRun) expect('foo', equals('bar')); | 75 if (!onExceptionRun) expect('foo', equals('bar')); |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 test('test 1', () => expect('foo', equals('foo'))); | 78 test('test 1', () => expect('foo', equals('foo'))); |
| 79 test('test 2', () => expect(onExceptionRun, isTrue)); | 79 test('test 2', () => expect(onExceptionRun, isTrue)); |
| 80 }, passing: ['test 2']); | 80 }, passing: ['test 2']); |
| 81 | 81 |
| 82 expectTestsPass("setUp doesn't apply to child groups", () { | |
| 83 var setUpRun = false; | |
| 84 setUp(() { | |
| 85 setUpRun = true; | |
| 86 currentSchedule.onComplete.schedule(() { | |
| 87 setUpRun = false; | |
| 88 }); | |
| 89 }); | |
| 90 | |
| 91 test('outer', () { | |
| 92 expect(setUpRun, isTrue); | |
| 93 }); | |
| 94 | |
| 95 group('group', () { | |
| 96 test('inner', () { | |
| 97 expect(setUpRun, isFalse); | |
| 98 }); | |
| 99 }); | |
| 100 }); | |
| 101 | |
| 102 expectTestsPass("setUp doesn't apply to parent groups", () { | |
| 103 var setUpRun = false; | |
| 104 group('group', () { | |
| 105 setUp(() { | |
| 106 setUpRun = true; | |
| 107 currentSchedule.onComplete.schedule(() { | |
| 108 setUpRun = false; | |
| 109 }); | |
| 110 }); | |
| 111 | |
| 112 test('inner', () { | |
| 113 expect(setUpRun, isTrue); | |
| 114 }); | |
| 115 }); | |
| 116 | |
| 117 test('outer', () { | |
| 118 expect(setUpRun, isFalse); | |
| 119 }); | |
| 120 }); | |
|
nweiz
2013/04/23 00:20:52
These should be replaced by tests that setUp *does
gram
2013/04/23 19:42:47
Done.
| |
| 121 | |
| 122 expectTestsPass("setUp doesn't apply to sibling groups", () { | 82 expectTestsPass("setUp doesn't apply to sibling groups", () { |
| 123 var setUpRun = false; | 83 var setUpRun = false; |
| 124 group('group 1', () { | 84 group('group 1', () { |
| 125 setUp(() { | 85 setUp(() { |
| 126 setUpRun = true; | 86 setUpRun = true; |
| 127 currentSchedule.onComplete.schedule(() { | 87 currentSchedule.onComplete.schedule(() { |
| 128 setUpRun = false; | 88 setUpRun = false; |
| 129 }); | 89 }); |
| 130 }); | 90 }); |
| 131 | 91 |
| 132 test('test 1', () { | 92 test('test 1', () { |
| 133 expect(setUpRun, isTrue); | 93 expect(setUpRun, isTrue); |
| 134 }); | 94 }); |
| 135 }); | 95 }); |
| 136 | 96 |
| 137 group('group 2', () { | 97 group('group 2', () { |
| 138 test('test 2', () { | 98 test('test 2', () { |
| 139 expect(setUpRun, isFalse); | 99 expect(setUpRun, isFalse); |
| 140 }); | 100 }); |
| 141 }); | 101 }); |
| 142 }); | 102 }); |
| 143 } | 103 } |
| OLD | NEW |