Index: pkg/gcloud/test/db/model_db_test.dart |
diff --git a/pkg/gcloud/test/db/model_db_test.dart b/pkg/gcloud/test/db/model_db_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bf8be81957f0a25d6322cee4ef7662a055996c21 |
--- /dev/null |
+++ b/pkg/gcloud/test/db/model_db_test.dart |
@@ -0,0 +1,53 @@ |
+// 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 gcloud.db_impl_test; |
+ |
+import 'dart:async'; |
+ |
+import 'package:gcloud/db.dart'; |
+import 'package:unittest/unittest.dart'; |
+ |
+ |
+// These unused imports make sure that [ModelDBImpl.fromLibrary()] will find |
+// all the Model/ModelDescription classes. |
+import 'model_dbs/duplicate_kind.dart' as test1; |
+import 'model_dbs/duplicate_property.dart' as test2; |
+import 'model_dbs/multiple_annotations.dart' as test3; |
+import 'model_dbs/duplicate_fieldname.dart' as test4; |
+import 'model_dbs/no_default_constructor.dart' as test5; |
+ |
+main() { |
+ newModelDB(Symbol symbol)=> new ModelDBImpl.fromLibrary(symbol); |
+ |
+ group('model_db', () { |
+ group('from_library', () { |
+ test('duplicate_kind', () { |
+ expect(new Future.sync(() { |
+ newModelDB(#gcloud.db.model_test.duplicate_kind); |
+ }), throwsA(isStateError)); |
+ }); |
+ test('duplicate_property', () { |
+ expect(new Future.sync(() { |
+ newModelDB(#gcloud.db.model_test.duplicate_property); |
+ }), throwsA(isStateError)); |
+ }); |
+ test('multiple_annotations', () { |
+ expect(new Future.sync(() { |
+ newModelDB(#gcloud.db.model_test.multiple_annotations); |
+ }), throwsA(isStateError)); |
+ }); |
+ test('duplicate_fieldname', () { |
+ expect(new Future.sync(() { |
+ newModelDB(#gcloud.db.model_test.duplicate_fieldname); |
+ }), throwsA(isStateError)); |
+ }); |
+ test('no_default_constructor', () { |
+ expect(new Future.sync(() { |
+ newModelDB(#gcloud.db.model_test.no_default_constructor); |
+ }), throwsA(isStateError)); |
+ }); |
+ }); |
+ }); |
+} |