Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: tools/testing/dart/multitest.dart

Issue 11883033: Fixed utf8 encoding/decoding issues in the testing scripts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/test_runner_test.dart ('k') | tools/testing/dart/test_progress.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
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;
contents = null;
Set<String> validMultitestOutcomes = new Set<String>.from(
['compile-time error', 'runtime error',
« no previous file with comments | « tests/standalone/io/test_runner_test.dart ('k') | tools/testing/dart/test_progress.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698