Chromium Code Reviews| Index: tools/testing/dart/multitest.dart |
| diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart |
| index abc4441992f5da124c5f101e98e99538540581e4..85a9d1bac816023966dcea840fa024586b916cbd 100644 |
| --- a/tools/testing/dart/multitest.dart |
| +++ b/tools/testing/dart/multitest.dart |
| @@ -7,6 +7,7 @@ library multitest; |
| import "dart:async"; |
| import "dart:io"; |
| import "test_suite.dart"; |
| +import "utils.dart"; |
| // Multitests are Dart test scripts containing lines of the form |
| // " [some dart code] /// [key]: [error type]" |
| @@ -58,15 +59,8 @@ void ExtractTestsFromMultitest(Path filePath, |
| // Read the entire file into a byte buffer and transform it to a |
| // String. This will treat the file as ascii but the only parts |
| // we are interested in will be ascii in any case. |
| - RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ); |
| - List chars = new List(file.lengthSync()); |
| - int offset = 0; |
| - while (offset != chars.length) { |
| - offset += file.readListSync(chars, offset, chars.length - offset); |
| - } |
| - file.closeSync(); |
| - String contents = new String.fromCharCodes(chars); |
| - chars = null; |
| + List bytes = new File.fromPath(filePath).readAsBytesSync(); |
| + String contents = decodeUtf8(bytes); |
|
ahe
2013/01/15 10:36:19
I would write this as:
decodeUtf8(new File.fromPa
kustermann
2013/01/15 12:22:10
I saw your comment too late, sorry.
|
| int first_newline = contents.indexOf('\n'); |
| final String line_separator = |
| (first_newline == 0 || contents[first_newline - 1] != '\r') |
| @@ -74,6 +68,7 @@ void ExtractTestsFromMultitest(Path filePath, |
| : '\r\n'; |
| List<String> lines = contents.split(line_separator); |
| if (lines.last == '') lines.removeLast(); |
| + bytes = null; |
|
ricow1
2013/01/15 10:25:37
why do you do this?
kustermann
2013/01/15 10:31:01
It was there before ('chars = null') so I left it.
ricow1
2013/01/15 10:33:00
I don't expect it to be that clever actually, it w
kustermann
2013/01/15 12:22:10
Just by accident, but this way 'bytes = null' and
|
| contents = null; |
| Set<String> validMultitestOutcomes = new Set<String>.from( |
| ['compile-time error', 'runtime error', |