| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class ListInputStream implements InputStream { | 5 class ListInputStream implements InputStream { |
| 6 List<int> read() { | 6 List<int> read() { |
| 7 var result = _data; | 7 var result = _data; |
| 8 _data = null; | 8 _data = null; |
| 9 return result; | 9 return result; |
| 10 } | 10 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // final \r cannot be interpreted as a end of line. | 156 // final \r cannot be interpreted as a end of line. |
| 157 for (int i = 0; i < 5; i++) { | 157 for (int i = 0; i < 5; i++) { |
| 158 line = stream.readLine(); | 158 line = stream.readLine(); |
| 159 Expect.equals("", line); | 159 Expect.equals("", line); |
| 160 } | 160 } |
| 161 line = stream.readLine(); | 161 line = stream.readLine(); |
| 162 Expect.equals(null, line); | 162 Expect.equals(null, line); |
| 163 stage++; | 163 stage++; |
| 164 s.close(); | 164 s.close(); |
| 165 } else if (stage == 3) { | 165 } else if (stage == 3) { |
| 166 // The final \r can not be interpreted as a end of line. | 166 // The final \r can now be interpreted as an end of line. |
| 167 line = stream.readLine(); | 167 line = stream.readLine(); |
| 168 Expect.equals("", line); | 168 Expect.equals("", line); |
| 169 line = stream.readLine(); | 169 line = stream.readLine(); |
| 170 Expect.equals(null, line); | 170 Expect.equals(null, line); |
| 171 Expect.equals(true, stream.closed); | 171 Expect.equals(true, stream.closed); |
| 172 stage++; | 172 stage++; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 stream.dataHandler = stringData; | 175 stream.dataHandler = stringData; |
| 176 s.write("Line1\nLine2\r\nLine3\rLi".charCodes()); | 176 s.write("Line1\nLine2\r\nLine3\rLi".charCodes()); |
| 177 Expect.equals(4, stage); | 177 Expect.equals(4, stage); |
| 178 } | 178 } |
| 179 | 179 |
| 180 main() { | 180 main() { |
| 181 testUtf8(); | 181 testUtf8(); |
| 182 testLatin1(); | 182 testLatin1(); |
| 183 testAscii(); | 183 testAscii(); |
| 184 testReadLine1(); | 184 testReadLine1(); |
| 185 testReadLine2(); | 185 testReadLine2(); |
| 186 } | 186 } |
| OLD | NEW |