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 observe.test.observe_test_utils; | 5 library observe.test.observe_test_utils; |
6 | 6 |
7 import 'dart:async'; | |
8 import 'package:observe/observe.dart'; | |
9 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
10 | 8 |
11 import 'package:observe/src/microtask.dart'; | 9 import 'package:observe/src/microtask.dart'; |
12 export 'package:observe/src/microtask.dart'; | 10 export 'package:observe/src/microtask.dart'; |
13 | 11 |
14 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords. | 12 // TODO(jmesserly): use matchers when we have a way to compare ChangeRecords. |
15 // For now just use the toString. | 13 // For now just use the toString. |
16 expectChanges(actual, expected, {reason}) => | 14 expectChanges(actual, expected, {reason}) => |
17 expect('$actual', '$expected', reason: reason); | 15 expect('$actual', '$expected', reason: reason); |
18 | 16 |
19 /** | 17 /** |
20 * This is a special kind of unit [test], that supports | 18 * This is a special kind of unit [test], that supports |
21 * calling [performMicrotaskCheckpoint] during the test to pump events | 19 * calling [performMicrotaskCheckpoint] during the test to pump events |
22 * that original from observable objects. | 20 * that original from observable objects. |
23 */ | 21 */ |
24 observeTest(name, testCase) => test(name, wrapMicrotask(testCase)); | 22 observeTest(name, testCase) => test(name, wrapMicrotask(testCase)); |
25 | 23 |
26 /** The [solo_test] version of [observeTest]. */ | 24 /** The [solo_test] version of [observeTest]. */ |
27 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase)); | 25 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase)); |
OLD | NEW |