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

Unified Diff: tests/language/metadata_test.dart

Issue 10913138: VM can parse and ignore metadata (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « tests/language/metadata_lib.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/metadata_test.dart
===================================================================
--- tests/language/metadata_test.dart (revision 0)
+++ tests/language/metadata_test.dart (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (c) 2012, 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.
+
+// Test ensuring that compiler can parse metadata. Need to add negative
+// test cases with illegal metadata annotations.
+
+#import("metadata_lib.dart", prefix: "Meta");
+
+class Tag {
+ final String annotation;
+ const Tag(this.annotation);
+}
+
+const meta1 = 1;
+const meta2 = const Tag("meta2");
+
+const extern = const Tag("external");
+
+@meta1 var topLevelVar;
+@Meta.Alien.unspecified() List unknownUnknowns;
+
+@meta1 typedef int DingDong<@meta2 T>(@meta1 event);
+
+@meta1 class A <@Tag("typeParam") T> {
+ @meta1 @meta2
+ static String staticField;
+
+ @Meta.Alien("ET") void foo(@meta1 bool fool, {@meta1 @Tag("opt") x: 100}) {
+ return x;
+ }
+
+ @Tag(@"timewarp")
+ List<int> getNextWeeksLottoNumbers() => [1, 2, 3, 4, 5, 6];
+}
+
+@meta1 main() {
+ @meta1 var a = new A();
+ Expect.equals(0, a.foo(false, x: 0));
+
+ for (@Tag("loopvar") int i = 0; i < 10; i++) {
+ // Do something.
+ }
+
+ @meta1 var s = @'This is a raw \\ string.';
+}
« no previous file with comments | « tests/language/metadata_lib.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698