| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import "dart:convert"; | 5 import "dart:convert"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 | 7 |
| 8 import "package:path/path.dart"; | 8 import "package:path/path.dart"; |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 test("hej\u0187", ['hej\u0187']); | 38 test("hej\u0187", ['hej\u0187']); |
| 39 | 39 |
| 40 test("hej\rhej\nhej\r", ['hej\rhej', 'hej\r']); | 40 test("hej\rhej\nhej\r", ['hej\rhej', 'hej\r']); |
| 41 | 41 |
| 42 test("hej\r\r\nhej\r\nhej\r", ['hej\r', 'hej', 'hej\r']); | 42 test("hej\r\r\nhej\r\nhej\r", ['hej\r', 'hej', 'hej\r']); |
| 43 | 43 |
| 44 test("hej", ['hej']); | 44 test("hej", ['hej']); |
| 45 } | 45 } |
| 46 | 46 |
| 47 |
| 47 void testEchoMode() { | 48 void testEchoMode() { |
| 48 stdin.echoMode = true; | 49 stdin.echoMode = true; |
| 49 Expect.isTrue(stdin.echoMode); | 50 Expect.isTrue(stdin.echoMode); |
| 50 stdin.echoMode = false; | 51 stdin.echoMode = false; |
| 51 Expect.isFalse(stdin.echoMode); | 52 Expect.isFalse(stdin.echoMode); |
| 52 var line; | 53 var line; |
| 53 while ((line = stdin.readLineSync()) != null) { | 54 while ((line = stdin.readLineSync()) != null) { |
| 54 print("You typed: $line"); | 55 print("You typed: $line"); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 59 |
| 58 void testLineMode() { | 60 void testLineMode() { |
| 59 stdin.lineMode = true; | 61 stdin.lineMode = true; |
| 60 Expect.isTrue(stdin.lineMode); | 62 Expect.isTrue(stdin.lineMode); |
| 61 stdin.lineMode = false; | 63 stdin.lineMode = false; |
| 62 Expect.isFalse(stdin.lineMode); | 64 Expect.isFalse(stdin.lineMode); |
| 63 var char; | 65 var char; |
| 64 while ((char = stdin.readByteSync()) != -1) { | 66 while ((char = stdin.readByteSync()) != -1) { |
| 65 print("You typed: $char"); | 67 print("You typed: $char"); |
| 66 } | 68 } |
| 67 } | 69 } |
| 68 | 70 |
| 69 | 71 |
| 70 void main() { | 72 void main() { |
| 71 testReadByte(); | 73 testReadByte(); |
| 72 | 74 |
| 73 // testEchoMode and testLineMode is an developer-interactive test, thus not | 75 // testEchoMode and testLineMode is developer-interactive tests, thus not |
| 74 // enabled. | 76 // enabled. |
| 75 //testEchoMode(); | 77 //testEchoMode(); |
| 76 //testLineMode(); | 78 //testLineMode(); |
| 77 } | 79 } |
| OLD | NEW |