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

Side by Side Diff: tests/compiler/dart2js/mirrors_test.dart

Issue 1302333006: Support metadata on patches. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove partial renaming Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 'package:compiler/src/mirrors/source_mirrors.dart'; 7 import 'package:compiler/src/mirrors/source_mirrors.dart';
8 import 'package:compiler/src/mirrors/mirrors_util.dart'; 8 import 'package:compiler/src/mirrors/mirrors_util.dart';
9 import 'package:compiler/src/mirrors/analyze.dart'; 9 import 'package:compiler/src/mirrors/analyze.dart';
10 import 'package:compiler/src/filenames.dart' 10 import 'package:compiler/src/filenames.dart'
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 var dartMirrorsLibrary = system.libraries[DART_MIRRORS_URI]; 176 var dartMirrorsLibrary = system.libraries[DART_MIRRORS_URI];
177 Expect.isNotNull(dartMirrorsLibrary); 177 Expect.isNotNull(dartMirrorsLibrary);
178 var commentType = dartMirrorsLibrary.declarations[#Comment]; 178 var commentType = dartMirrorsLibrary.declarations[#Comment];
179 Expect.isNotNull(commentType); 179 Expect.isNotNull(commentType);
180 180
181 // /// Singleline doc comment. 181 // /// Singleline doc comment.
182 metadata = metadataList[metadataListIndex++]; 182 metadata = metadataList[metadataListIndex++];
183 Expect.isTrue(metadata is InstanceMirror); 183 Expect.isTrue(metadata is InstanceMirror);
184 Expect.isFalse(metadata.hasReflectee); 184 Expect.isFalse(metadata.hasReflectee);
185 Expect.throws(() => metadata.reflectee, (_) => true); 185 Expect.throws(() => metadata.reflectee, (_) => true);
186 Expect.isTrue(metadata is CommentInstanceMirror); 186 Expect.isTrue(metadata is CommentInstanceMirror,
187 "Unexpected metadata: $metadata");
187 Expect.equals(commentType.originalDeclaration, metadata.type); 188 Expect.equals(commentType.originalDeclaration, metadata.type);
188 Expect.isTrue(metadata.isDocComment); 189 Expect.isTrue(metadata.isDocComment);
189 Expect.stringEquals( 190 Expect.stringEquals(
190 "/// Singleline doc comment.", metadata.text); 191 "/// Singleline doc comment.", metadata.text);
191 Expect.stringEquals( 192 Expect.stringEquals(
192 "Singleline doc comment.", metadata.trimmedText); 193 "Singleline doc comment.", metadata.trimmedText);
193 194
194 // @Metadata 195 // @Metadata
195 metadata = metadataList[metadataListIndex++]; 196 metadata = metadataList[metadataListIndex++];
196 Expect.isTrue(metadata is InstanceMirror); 197 Expect.isTrue(metadata is InstanceMirror);
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 Expect.isTrue(privateFactoryConstructor.isPrivate); 987 Expect.isTrue(privateFactoryConstructor.isPrivate);
987 Expect.isFalse(privateFactoryConstructor.isConstConstructor); 988 Expect.isFalse(privateFactoryConstructor.isConstConstructor);
988 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); 989 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor);
989 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); 990 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor);
990 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); 991 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor);
991 992
992 var metadata = privateClass.metadata; 993 var metadata = privateClass.metadata;
993 Expect.isNotNull(metadata); 994 Expect.isNotNull(metadata);
994 Expect.equals(0, metadata.length); 995 Expect.equals(0, metadata.length);
995 } 996 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698