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: test_reflectable/test/metadata_test.dart

Issue 1236983004: Support metadata for methods and fields in the transformed view. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Addressing review. Adding tests for name-clashes. Created 5 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 | « test_reflectable/test/metadata_name_clash_test.dart ('k') | test_reflectable/test/name_clash_lib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test_reflectable/test/metadata_test.dart
diff --git a/test_reflectable/test/metadata_test.dart b/test_reflectable/test/metadata_test.dart
index 19adc8403453008c28589f6c0d9e44e2e8615c45..41e3a34eed9235803e743118fe45f82d48551764 100644
--- a/test_reflectable/test/metadata_test.dart
+++ b/test_reflectable/test/metadata_test.dart
@@ -3,8 +3,7 @@
// the LICENSE file.
/// Tests that metadata is preserved when the metadataCapability is present.
-// TODO(sigurdm): Support for metadata-annotations of members.
-// TODO(sigurdm): Support for metadata-anmntations of arguments.
+// TODO(sigurdm): Support for metadata-annotations of arguments.
library test_reflectable.test.metadata_test;
@@ -12,13 +11,15 @@ import 'package:reflectable/reflectable.dart';
import 'package:unittest/unittest.dart';
class MyReflectable extends Reflectable {
- const MyReflectable() : super(metadataCapability);
+ const MyReflectable() : super(
+ metadataCapability, instanceInvokeCapability, staticInvokeCapability);
}
const myReflectable = const MyReflectable();
class MyReflectable2 extends Reflectable {
- const MyReflectable2() : super();
+ const MyReflectable2()
+ : super(instanceInvokeCapability, staticInvokeCapability);
}
const myReflectable2 = const MyReflectable2();
@@ -30,13 +31,23 @@ const c = const [const Bar(const {"a": 14})];
@Bar(const {})
@b
@c
-class Foo {}
+class Foo {
+ @Bar(const {})
+ @b
+ @c
+ foo() {}
+}
@myReflectable2
@Bar(const {})
@b
@c
-class Foo2 {}
+class Foo2 {
+ @Bar(const {})
+ @b
+ @c
+ foo() {}
+}
class Bar {
final Map<String, int> m;
@@ -51,9 +62,16 @@ main() {
13,
const [const Bar(const {"a": 14})]
]);
+ expect(myReflectable.reflectType(Foo).declarations["foo"].metadata, [
+ const Bar(const {}),
+ 13,
+ const [const Bar(const {"a": 14})]
+ ]);
});
test("metadata without capability", () {
expect(() => myReflectable2.reflectType(Foo2).metadata,
throwsA(const isInstanceOf<NoSuchCapabilityError>()));
+ expect(() => myReflectable2.reflectType(Foo2).declarations["foo"].metadata,
+ throwsA(const isInstanceOf<NoSuchCapabilityError>()));
});
}
« no previous file with comments | « test_reflectable/test/metadata_name_clash_test.dart ('k') | test_reflectable/test/name_clash_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698