| 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 "package:unittest/unittest.dart"; | 6 import "package:unittest/unittest.dart"; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 test("stream iterator basic", () { | 9 test("stream iterator basic", () { |
| 10 StreamController c = new StreamController(); | 10 StreamController c = new StreamController(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 test("stream iterator error", () { | 49 test("stream iterator error", () { |
| 50 StreamController c = new StreamController(); | 50 StreamController c = new StreamController(); |
| 51 Stream s = c.stream; | 51 Stream s = c.stream; |
| 52 StreamIterator i = new StreamIterator(s); | 52 StreamIterator i = new StreamIterator(s); |
| 53 i.moveNext().then(expectAsync1((bool b) { | 53 i.moveNext().then(expectAsync1((bool b) { |
| 54 expect(b, isTrue); | 54 expect(b, isTrue); |
| 55 expect(42, i.current); | 55 expect(42, i.current); |
| 56 return i.moveNext(); | 56 return i.moveNext(); |
| 57 })).then((bool b) { | 57 })).then((bool b) { |
| 58 Expect.fail("Result not expected"); | 58 fail("Result not expected"); |
| 59 }, onError: expectAsync1((e) { | 59 }, onError: expectAsync1((e) { |
| 60 expect("BAD", e); | 60 expect("BAD", e); |
| 61 return i.moveNext(); | 61 return i.moveNext(); |
| 62 })).then(expectAsync1((bool b) { | 62 })).then(expectAsync1((bool b) { |
| 63 expect(b, isFalse); | 63 expect(b, isFalse); |
| 64 })); | 64 })); |
| 65 c.add(42); | 65 c.add(42); |
| 66 c.addError("BAD"); | 66 c.addError("BAD"); |
| 67 c.add(37); | 67 c.add(37); |
| 68 c.close(); | 68 c.close(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 })).then(expectAsync1((bool b) { | 85 })).then(expectAsync1((bool b) { |
| 86 expect(b, isTrue); | 86 expect(b, isTrue); |
| 87 expect(37, i.current); | 87 expect(37, i.current); |
| 88 return i.moveNext(); | 88 return i.moveNext(); |
| 89 })).then(expectAsync1((bool b) { | 89 })).then(expectAsync1((bool b) { |
| 90 expect(b, isFalse); | 90 expect(b, isFalse); |
| 91 })); | 91 })); |
| 92 c.add(42); | 92 c.add(42); |
| 93 }); | 93 }); |
| 94 } | 94 } |
| OLD | NEW |