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

Side by Side Diff: dart/tests/lib/mirrors/metadata_test.dart

Issue 16101007: Implement LibraryMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 @fisk @symbol
6 library test.metadata_test;
7
8 import 'dart:mirrors';
9
10 const fisk = 'a metadata string';
11
12 const symbol = const Symbol('fisk');
13
14 main() {
15 MirrorSystem mirrors = currentMirrorSystem();
16 LibraryMirror library =
17 mirrors.findLibrary(const Symbol('test.metadata_test')).first;
kasperl 2013/05/29 06:25:06 Should findLibrary be renamed? It would be easier
ahe 2013/05/29 06:40:28 That's a good suggestion.
ahe 2013/05/30 11:41:15 Filed bug: http://dartbug.com/10958
18 List metadata = library.metadata.map((m) => m.reflectee).toList();
19 if (metadata.length != 2) {
20 throw 'Expected two pieces of metadata on library';
21 }
22 if (!metadata.contains(fisk)) {
23 throw '$metadata does not contain "$fisk"';
24 }
25 if (!metadata.contains(symbol)) {
26 throw '$metadata does not contain "$symbol"';
27 }
28 if (MirrorSystem.getName(symbol) != 'fisk') {
29 // This happened in dart2js due to how early library metadata is
kasperl 2013/05/29 06:25:06 This happened? I guess this is a regression test f
ahe 2013/05/29 06:40:28 It is not really a regression test. I inspected t
30 // computed.
31 throw 'Bad constant: $symbol';
32 }
33 print(metadata);
kasperl 2013/05/29 06:25:06 Intentional?
ahe 2013/05/29 06:40:28 Yeah. I distrust tests that don't produce output.
34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698