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

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

Issue 2984203002: Move the status file parser into its own package. (Closed)
Patch Set: Created 3 years, 5 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/expectation.dart ('k') | tools/testing/dart/status_expression.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/expectation_set.dart
diff --git a/tools/testing/dart/expectation_set.dart b/tools/testing/dart/expectation_set.dart
index f2091420dec44e7c9f2118472954150f07177e65..60ff18874b7ef3a993c5255c11536d1417be1c63 100644
--- a/tools/testing/dart/expectation_set.dart
+++ b/tools/testing/dart/expectation_set.dart
@@ -2,10 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:io';
+
+import 'package:status_file/expectation.dart';
+import 'package:status_file/status_file.dart';
+
import 'configuration.dart';
import 'environment.dart';
-import 'expectation.dart';
-import 'status_file.dart';
/// Tracks the [Expectation]s associated with a set of file paths.
///
@@ -18,20 +21,28 @@ class ExpectationSet {
/// when in [configuration].
static ExpectationSet read(
List<String> statusFilePaths, Configuration configuration) {
- var environment = new Environment(configuration);
- var expectations = new ExpectationSet._();
- for (var path in statusFilePaths) {
- var file = new StatusFile.read(path);
- for (var section in file.sections) {
- if (section.isEnabled(environment)) {
- for (var entry in section.entries) {
- expectations.addEntry(entry);
+ try {
+ var environment = new ConfigurationEnvironment(configuration);
+ var expectations = new ExpectationSet._();
+ for (var path in statusFilePaths) {
+ var file = new StatusFile.read(path);
+ file.validate(environment);
+ for (var section in file.sections) {
+ if (section.isEnabled(environment)) {
+ for (var entry in section.entries) {
+ expectations.addEntry(entry);
+ }
}
}
}
- }
- return expectations;
+ return expectations;
+ } on SyntaxError catch (error) {
+ stderr.writeln(error.toString());
+ exit(1);
+
+ throw "unreachable";
+ }
}
// Only create one copy of each Set<Expectation>.
« no previous file with comments | « tools/testing/dart/expectation.dart ('k') | tools/testing/dart/status_expression.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698