Chromium Code Reviews| 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..1c05128cd7689ba76730458ed9439dc021e2fa36 |
| --- /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\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
|
| + break; |
| + |
| + case 1: |
| + if (line != '\n') throw "bad line at $i"; |
| + break; |
| + |
| + case 2: |
| + if (line != '4\n') throw "bad line at $i"; |
| + break; |
| + } |
| + i++; |
| + } |
| + if (i != 3 ) throw "expect 3 lines"; |
| + print('true'); |
| +} |