| Index: tests/co19/test_config.dart
|
| diff --git a/tests/co19/test_config.dart b/tests/co19/test_config.dart
|
| index aff0555c872965637552e389bf0c641791edb178..ee57ae94409f53c9ee6ffde2dead6f1c32bbe960 100644
|
| --- a/tests/co19/test_config.dart
|
| +++ b/tests/co19/test_config.dart
|
| @@ -110,41 +110,53 @@ class Co19TestSuite {
|
| Map testOptions(String filename) {
|
| RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)");
|
| RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)");
|
| +
|
| + // 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.
|
| File file = new File(filename);
|
| - FileInputStream fileStream = file.openInputStream();
|
| - StringInputStream lines = new StringInputStream(fileStream);
|
| + file.openSync();
|
| + List chars = new List(file.lengthSync());
|
| + var offset = 0;
|
| + while (offset != chars.length) {
|
| + offset += file.readListSync(chars, offset, chars.length - offset);
|
| + }
|
| + file.closeSync();
|
| + String contents = new String.fromCharCodes(chars);
|
| + chars = null;
|
|
|
| + // Find the options in the file.
|
| List<List> result = new List<List>();
|
| List<String> dartOptions;
|
| bool isNegative = false;
|
| - String line;
|
| - while ((line = lines.readLine()) != null) {
|
| - Match match = testOptionsRegExp.firstMatch(line);
|
| - if (match != null) {
|
| - result.add(match[1].split(' ').filter((e) => e != ''));
|
| - }
|
|
|
| - match = dartOptionsRegExp.firstMatch(line);
|
| - if (match != null) {
|
| - if (dartOptions != null) {
|
| - throw new Exception(
|
| - 'More than one "// DartOptions=" line in test $filename');
|
| - }
|
| - dartOptions = match[1].split(' ').filter((e) => e != '');
|
| - }
|
| + Iterable<Match> matches = testOptionsRegExp.allMatches(contents);
|
| + for (var match in matches) {
|
| + result.add(match[1].split(' ').filter((e) => e != ''));
|
| + }
|
|
|
| - if (line.contains("@compile-error") || line.contains("@runtime-error")) {
|
| - isNegative = true;
|
| - } else if (line.contains("@dynamic-type-error") &&
|
| - configuration['checked']) {
|
| - isNegative = true;
|
| + matches = dartOptionsRegExp.allMatches(contents);
|
| + for (var match in matches) {
|
| + if (dartOptions != null) {
|
| + throw new Exception(
|
| + 'More than one "// DartOptions=" line in test $filename');
|
| }
|
| + dartOptions = match[1].split(' ').filter((e) => e != '');
|
| + }
|
| +
|
| + if (contents.contains("@compile-error") ||
|
| + contents.contains("@runtime-error")) {
|
| + isNegative = true;
|
| + } else if (contents.contains("@dynamic-type-error") &&
|
| + configuration['checked']) {
|
| + isNegative = true;
|
| }
|
| +
|
| return { "vmOptions": result,
|
| "dartOptions": dartOptions,
|
| "isNegative" : isNegative };
|
| }
|
|
|
| - void completeHandler(TestCase testCase) {
|
| + void completeHandler(TestCase test) {
|
| }
|
| }
|
|
|