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

Unified 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: Add retainNewlines Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/io/stdin_sync_script.dart
diff --git a/tests/standalone/io/stdin_sync_script.dart b/tests/standalone/io/stdin_sync_script.dart
new file mode 100644
index 0000000000000000000000000000000000000000..acd35d221356afb5b7de5513db984f2d7ea824be
--- /dev/null
+++ b/tests/standalone/io/stdin_sync_script.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:io";
+
+void main() {
+ int i = 0;
+ String line;
+ while ((line = stdin.readLineSync()) != null) {
+ switch (i) {
+ case 0:
+ if (line != 'hej\x01\x00') throw "bad line at $i";
+ break;
+
+ case 1:
+ if (line != '') throw "bad line at $i";
+ break;
+
+ case 2:
+ if (line != '4') throw "bad line at $i";
+ break;
+ }
+ i++;
+ }
+ if (i != 3 ) throw "expect 3 lines";
+ print('true');
+}

Powered by Google App Engine
This is Rietveld 408576698