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

Unified Diff: pkg/scheduled_test/lib/src/descriptor/entry.dart

Issue 12853005: Change the way Patterns work in scheduled_test/descriptor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add Nothing.validateNow. Created 7 years, 9 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
Index: pkg/scheduled_test/lib/src/descriptor/entry.dart
diff --git a/pkg/scheduled_test/lib/src/descriptor/entry.dart b/pkg/scheduled_test/lib/src/descriptor/entry.dart
index 9605a1cf934485df11b5249642f09cb919cde54e..ab44336795cf6d995236a3283502a4f938f99485 100644
--- a/pkg/scheduled_test/lib/src/descriptor/entry.dart
+++ b/pkg/scheduled_test/lib/src/descriptor/entry.dart
@@ -7,17 +7,13 @@ library descriptor.entry;
import 'dart:async';
import '../utils.dart';
-import 'utils.dart';
/// The base class for various declarative descriptions of filesystem entries.
/// All asynchronous operations on descriptors are [schedule]d unless otherwise
/// noted.
abstract class Entry {
- /// The name of this entry. For most operations, this must be a [String];
- /// however, if the entry will only be used for validation, it may be a
- /// non-[String] [Pattern]. In this case, there must be only one entry
- /// matching it in the physical filesystem for validation to succeed.
- final Pattern name;
+ /// The name of this entry.
+ final String name;
Entry(this.name);
@@ -35,6 +31,10 @@ abstract class Entry {
/// [parent] defaults to [defaultRoot].
Future validate([String parent]);
+ /// An unscheduled version of [validate]. This is useful if validation errors
+ /// need to be caught, since otherwise they'd be registered by the schedule.
+ Future validateNow([String parent]);
+
/// Treats [this] as an in-memory filesystem and returns a stream of the
/// contents of the child entry located at [path]. This only works if [this]
/// is a directory entry. This operation is not [schedule]d.
@@ -45,7 +45,7 @@ abstract class Entry {
/// All errors in loading the file will be passed through the returned
/// [Stream].
Stream<List<int>> load(String pathToLoad) => errorStream("Can't load "
- "'$pathToLoad' from within $nameDescription: not a directory.");
+ "'$pathToLoad' from within '$name': not a directory.");
/// Returns the contents of [this] as a stream. This only works if [this] is a
/// file entry. This operation is not [schedule]d.
@@ -54,17 +54,6 @@ abstract class Entry {
/// [Stream].
Stream<List<int>> read();
- /// Asserts that the name of the descriptor is a [String] and returns it.
- String get stringName {
- if (name is String) return name;
- throw 'Pattern $nameDescription must be a string.';
- }
-
- /// Returns a human-readable description of [name], for error reporting. For
- /// string names, this will just be the name in quotes; for regular
- /// expressions, it will use JavaScript-style `/.../` notation.
- String get nameDescription => describePattern(name);
-
/// Returns a detailed tree-style description of [this].
String describe();
}

Powered by Google App Engine
This is Rietveld 408576698