Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
| OLD | NEW |