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

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

Issue 1859973002: Autoformat tools/testing/dart (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Format whole directory Created 4 years, 8 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 | « tools/testing/dart/http_server.dart ('k') | tools/testing/dart/path.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 005cdc0893a2e780c24954e678dfce25e99df87a..d39bc9ae6a1225824ded5140dd7783f71c77ae30 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -61,27 +61,28 @@ import "utils.dart";
// ddd /// 07: static type warning, dynamic type error
// fff
-void ExtractTestsFromMultitest(Path filePath,
- Map<String, String> tests,
- Map<String, Set<String>> outcomes) {
+void ExtractTestsFromMultitest(Path filePath, Map<String, String> tests,
+ Map<String, Set<String>> outcomes) {
// 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.
List bytes = new File(filePath.toNativePath()).readAsBytesSync();
String contents = decodeUtf8(bytes);
int first_newline = contents.indexOf('\n');
- final String line_separator =
- (first_newline == 0 || contents[first_newline - 1] != '\r')
- ? '\n'
- : '\r\n';
+ final String line_separator = (first_newline == 0 ||
+ contents[first_newline - 1] != '\r') ? '\n' : '\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(
- ['ok', 'compile-time error', 'runtime error',
- 'static type warning', 'dynamic type error',
- 'checked mode compile-time error']);
+ Set<String> validMultitestOutcomes = new Set<String>.from([
+ 'ok',
+ 'compile-time error',
+ 'runtime error',
+ 'static type warning',
+ 'dynamic type error',
+ 'checked mode compile-time error'
+ ]);
// Create the set of multitests, which will have a new test added each
// time we see a multitest line with a new key.
@@ -96,8 +97,8 @@ void ExtractTestsFromMultitest(Path filePath,
lineCount++;
var annotation = new _Annotation.from(line);
if (annotation != null) {
- testsAsLines.putIfAbsent(annotation.key,
- () => new List<String>.from(testsAsLines["none"]));
+ testsAsLines.putIfAbsent(
+ annotation.key, () => new List<String>.from(testsAsLines["none"]));
// Add line to test with annotation.key as key, empty line to the rest.
for (var key in testsAsLines.keys) {
testsAsLines[key].add(annotation.key == key ? line : "");
@@ -172,8 +173,8 @@ class _Annotation {
var annotation = new _Annotation();
annotation.key = parts[0];
annotation.rest = parts[1];
- annotation.outcomesList = annotation.rest.split(',')
- .map((s) => s.trim()).toList();
+ annotation.outcomesList =
+ annotation.rest.split(',').map((s) => s.trim()).toList();
return annotation;
}
}
@@ -219,8 +220,8 @@ Set<String> _findAllRelativeImports(Path topLibrary) {
return foundImports;
}
-Future doMultitest(Path filePath, String outputDir, Path suiteDir,
- CreateTest doTest) {
+Future doMultitest(
+ Path filePath, String outputDir, Path suiteDir, CreateTest doTest) {
void writeFile(String filepath, String content) {
final File file = new File(filepath);
@@ -254,8 +255,8 @@ Future doMultitest(Path filePath, String outputDir, Path suiteDir,
TestUtils.mkdirRecursive(targetDir, importDir);
}
// Copy file.
- futureCopies.add(TestUtils.copyFile(sourceDir.join(importPath),
- targetDir.join(importPath)));
+ futureCopies.add(TestUtils.copyFile(
+ sourceDir.join(importPath), targetDir.join(importPath)));
}
// Wait until all imports are copied before scheduling test cases.
@@ -272,21 +273,17 @@ Future doMultitest(Path filePath, String outputDir, Path suiteDir,
bool isNegativeIfChecked = outcome.contains('dynamic type error');
bool hasCompileErrorIfChecked =
outcome.contains('checked mode compile-time error');
- doTest(multitestFilename,
- filePath,
- hasCompileError,
- hasRuntimeErrors,
- isNegativeIfChecked: isNegativeIfChecked,
- hasCompileErrorIfChecked: hasCompileErrorIfChecked,
- hasStaticWarning: hasStaticWarning,
- multitestKey: key);
+ doTest(multitestFilename, filePath, hasCompileError, hasRuntimeErrors,
+ isNegativeIfChecked: isNegativeIfChecked,
+ hasCompileErrorIfChecked: hasCompileErrorIfChecked,
+ hasStaticWarning: hasStaticWarning,
+ multitestKey: key);
}
return null;
});
}
-
Path CreateMultitestDirectory(String outputDir, Path suiteDir) {
Directory generatedTestDir = new Directory('$outputDir/generated_tests');
if (!new Directory(outputDir).existsSync()) {
« no previous file with comments | « tools/testing/dart/http_server.dart ('k') | tools/testing/dart/path.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698