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

Side by Side Diff: tests/lib/convert/close_test.dart

Issue 1908943004: Fix void foo(..) => ... to use { } instead. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Upload Created 4 years, 8 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 | « sdk/lib/io/websocket_impl.dart ('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) 2016, 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 "package:expect/expect.dart";
6 import "dart:convert";
7
8 class MySink implements Sink<List<int>> {
9 List<int> accumulated = <int>[];
10 bool isClosed = false;
11
12 add(List<int> list) {
13 accumulated.addAll(list);
14 return list.length;
15 }
16
17 close() {
18 isClosed = true;
19 // Returning a value here triggered a bug, where the caller was trying to
20 // pass the value through its 'void' return type.
21 // Example: void close() => _sink.close();
22 return "done";
23 }
24 }
25
26 main() {
27 var mySink = new MySink();
28 var byteSink = new ByteConversionSink.from(mySink);
29 byteSink.add([1, 2, 3]);
30 byteSink.close();
31 Expect.listEquals([1, 2, 3], mySink.accumulated);
32 Expect.isTrue(mySink.isClosed);
33 }
OLDNEW
« no previous file with comments | « sdk/lib/io/websocket_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698