OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 stream_controller_async_test; | 5 library stream_controller_async_test; |
6 | 6 |
| 7 import "package:expect/expect.dart"; |
7 import 'dart:async'; | 8 import 'dart:async'; |
8 import 'package:test/test.dart'; | 9 import 'package:unittest/unittest.dart'; |
9 import 'event_helper.dart'; | 10 import 'event_helper.dart'; |
10 import 'stream_state_helper.dart'; | 11 import 'stream_state_helper.dart'; |
11 | 12 |
12 class A { const A(); } | 13 class A { const A(); } |
13 class B extends A { const B(); } | 14 class B extends A { const B(); } |
14 | 15 |
15 main() { | 16 main() { |
16 Events sentEvents = new Events()..close(); | 17 Events sentEvents = new Events()..close(); |
17 | 18 |
18 // Make sure that lastWhere allows to return instances of types that are | 19 // Make sure that lastWhere allows to return instances of types that are |
19 // different than the generic type of the stream. | 20 // different than the generic type of the stream. |
20 test("lastWhere with super class", () { | 21 test("lastWhere with super class", () { |
21 StreamController c = new StreamController<B>(); | 22 StreamController c = new StreamController<B>(); |
22 Future f = c.stream.lastWhere((x) => false, defaultValue: () => const A()); | 23 Future f = c.stream.lastWhere((x) => false, defaultValue: () => const A()); |
23 f.then(expectAsync((v) { expect(const A(), equals(v)); })); | 24 f.then(expectAsync((v) { Expect.equals(const A(), v); })); |
24 sentEvents.replay(c); | 25 sentEvents.replay(c); |
25 }); | 26 }); |
26 } | 27 } |
OLD | NEW |