Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: test/byte_collection_test.dart

Issue 2649233006: Add `byteCollector` stream transformer and `collectBytes` function. (Closed)
Patch Set: Address comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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 import "dart:typed_data";
7
8 import "package:test/test.dart";
9 import "package:async/async.dart" show byteCollector, collectBytes, Result;
10
11 void main() {
12 group("collectBytes", () {
13 test("simple list and overflow", () {
14 var result = collectBytes(new Stream.fromIterable([
15 [0],
16 [1],
17 [2],
18 [256]
19 ]));
20 expect(result, completion([0, 1, 2, 0]));
21 });
22
23 test("no events", () {
24 var result = collectBytes(new Stream.fromIterable([]));
25 expect(result, completion([]));
26 });
27
28 test("empty events", () {
29 var result = collectBytes(new Stream.fromIterable([[], []]));
30 expect(result, completion([]));
31 });
32
33 test("error event", () {
34 var result = collectBytes(new Stream.fromIterable(
35 new Iterable.generate(3, (n) => n == 2 ? throw "badness" : [n])));
36 expect(result, throwsA("badness"));
37 });
38 });
39 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698