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

Unified Diff: pkg/analysis_server/test/integration/integration_tests.dart

Issue 459643002: Improve matchers for enums defined by the analysis server API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « no previous file | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/integration/integration_tests.dart
diff --git a/pkg/analysis_server/test/integration/integration_tests.dart b/pkg/analysis_server/test/integration/integration_tests.dart
index dbd26a72f4485857e07da8d05a53be2e54eb4d35..01e6ba086c4a2bc219fa9a9792cba4e2f80c1f87 100644
--- a/pkg/analysis_server/test/integration/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/integration_tests.dart
@@ -288,6 +288,32 @@ abstract class _RecursiveMatcher extends Matcher {
}
/**
+ * Matcher that matches a String drawn from a limited set.
+ */
+class MatchesEnum extends Matcher {
+ /**
+ * Short description of the expected type.
+ */
+ final String description;
+
+ /**
+ * The set of enum values that are allowed.
+ */
+ final List<String> allowedValues;
+
+ const MatchesEnum(this.description, this.allowedValues);
+
+ @override
+ bool matches(item, Map matchState) {
+ return allowedValues.contains(item);
+ }
+
+ @override
+ Description describe(Description description) => description.add(
+ this.description);
+}
+
+/**
* Matcher that matches a JSON object, with a given set of required and
* optional fields, and their associated types (expressed as [Matcher]s).
*/
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698