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

Unified Diff: pkg/appengine/test/utils/error_matchers.dart

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years 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 | « pkg/appengine/test/remote_api_test.dart ('k') | pkg/appengine/test/utils/mock_rpc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/appengine/test/utils/error_matchers.dart
diff --git a/pkg/appengine/test/utils/error_matchers.dart b/pkg/appengine/test/utils/error_matchers.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7d7001cbb5e8c0c9f013f30d788962ca1cd1be06
--- /dev/null
+++ b/pkg/appengine/test/utils/error_matchers.dart
@@ -0,0 +1,84 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library error_matchers;
+
+import 'package:unittest/unittest.dart';
+
+import 'package:appengine/api/errors.dart';
+import 'package:gcloud/datastore.dart' as datastore;
+
+import 'package:memcache/memcache.dart' as memcache;
+
+class _NetworkError extends TypeMatcher {
+ const _NetworkError() : super("NetworkError");
+ bool matches(item, Map matchState) => item is NetworkError;
+}
+
+class _ProtocolError extends TypeMatcher {
+ const _ProtocolError() : super("ProtocolError");
+ bool matches(item, Map matchState) => item is ProtocolError;
+}
+
+class _ServiceError extends TypeMatcher {
+ const _ServiceError() : super("ServiceError");
+ bool matches(item, Map matchState) => item is ServiceError;
+}
+
+class _ApplicationError extends TypeMatcher {
+ const _ApplicationError() : super("ApplicationError");
+ bool matches(item, Map matchState) => item is datastore.ApplicationError;
+}
+
+class _AppEngineApplicationError extends TypeMatcher {
+ const _AppEngineApplicationError() : super("ApplicationError");
+ bool matches(item, Map matchState) => item is ApplicationError;
+}
+
+class _TransactionAbortedError extends TypeMatcher {
+ const _TransactionAbortedError() : super("TransactionAbortedError");
+ bool matches(item, Map matchState)
+ => item is datastore.TransactionAbortedError;
+}
+
+class _NeedIndexError extends TypeMatcher {
+ const _NeedIndexError() : super("NeedIndexError");
+ bool matches(item, Map matchState) => item is datastore.NeedIndexError;
+}
+
+class _TimeoutError extends TypeMatcher {
+ const _TimeoutError() : super("TimeoutError");
+ bool matches(item, Map matchState) => item is datastore.TimeoutError;
+}
+
+class _MemcacheError extends TypeMatcher {
+ const _MemcacheError() : super("MemcacheError");
+ bool matches(item, Map matchState) => item is memcache.MemcacheError;
+}
+
+class _MemcacheNotStoredError extends TypeMatcher {
+ const _MemcacheNotStoredError() : super("NotStoredError");
+ bool matches(item, Map matchState) => item is memcache.NotStoredError;
+}
+
+
+class _IntMatcher extends TypeMatcher {
+ const _IntMatcher() : super("IntMatcher");
+ bool matches(item, Map matchState) => item is int;
+}
+
+const isNetworkError = const _NetworkError();
+const isProtocolError = const _ProtocolError();
+const isServiceError = const _ServiceError();
+const isApplicationError = const _ApplicationError();
+const isAppEngineApplicationError = const _AppEngineApplicationError();
+
+const isTransactionAbortedError = const _TransactionAbortedError();
+const isNeedIndexError = const _NeedIndexError();
+const isTimeoutError = const _TimeoutError();
+
+const isMemcacheError = const _MemcacheError();
+const isMemcacheNotStored = const _MemcacheNotStoredError();
+
+const isInt = const _IntMatcher();
« no previous file with comments | « pkg/appengine/test/remote_api_test.dart ('k') | pkg/appengine/test/utils/mock_rpc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698