| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'dart:async'; |
| 6 |
| 7 import 'package:unittest/unittest.dart'; |
| 8 |
| 9 main() { |
| 10 // Test the sync test 'breath' feature of unittest. |
| 11 |
| 12 group('breath', () { |
| 13 var sentinel = 0; |
| 14 var start; |
| 15 |
| 16 test('initial', () { |
| 17 Timer.run(() { sentinel = 1; }); |
| 18 }); |
| 19 |
| 20 test('starve', () { |
| 21 start = new DateTime.now().millisecondsSinceEpoch; |
| 22 var now; |
| 23 do { |
| 24 expect(sentinel, 0); |
| 25 now = new DateTime.now().millisecondsSinceEpoch; |
| 26 } while (now - start <= BREATH_INTERVAL); |
| 27 }); |
| 28 |
| 29 test('breathed', () { |
| 30 expect(sentinel, 1); |
| 31 }); |
| 32 }); |
| 33 } |
| 34 |
| OLD | NEW |