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

Side by Side Diff: tests/standalone/io/stdin_sync_script.dart

Issue 18516002: Add Stdio.readByteSync and Stdio.readLineSync. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:io";
6
7 void main() {
8 int i = 0;
9 String line;
10 while ((line = stdin.readLineSync()) != null) {
11 switch (i) {
12 case 0:
13 if (line != 'hej\x01\x00\r\n') throw "bad line at $i";
Bill Hesse 2013/07/02 11:31:54 No non-ascii tests? Can we do a non-default UTF-8
Anders Johnsen 2013/07/02 12:21:27 Added non-ascii test. The exception will not happe
14 break;
15
16 case 1:
17 if (line != '\n') throw "bad line at $i";
18 break;
19
20 case 2:
21 if (line != '4\n') throw "bad line at $i";
22 break;
23 }
24 i++;
25 }
26 if (i != 3 ) throw "expect 3 lines";
27 print('true');
28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698