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

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

Issue 1916053003: Add toStructuredText to ConstantExpression and align method names with ConstantValue (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: dartfmt Created 4 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 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 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 /// Test that the @MirrorsUsed annotation suppress hints and that only 5 /// Test that the @MirrorsUsed annotation suppress hints and that only
6 /// requested elements are retained for reflection. 6 /// requested elements are retained for reflection.
7 library dart2js.test.mirrors_used_test; 7 library dart2js.test.mirrors_used_test;
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // There should at least be one metadata constant: 130 // There should at least be one metadata constant:
131 // 1. The constructed constant for 'MirrorsUsed'. 131 // 1. The constructed constant for 'MirrorsUsed'.
132 Expect.isTrue(backend.metadataConstants.length >= 1); 132 Expect.isTrue(backend.metadataConstants.length >= 1);
133 133
134 Set<ConstantValue> compiledConstants = backend.constants.compiledConstants; 134 Set<ConstantValue> compiledConstants = backend.constants.compiledConstants;
135 // Make sure that most of the metadata constants aren't included in the 135 // Make sure that most of the metadata constants aren't included in the
136 // generated code. 136 // generated code.
137 for (var dependency in backend.metadataConstants) { 137 for (var dependency in backend.metadataConstants) {
138 ConstantValue constant = dependency.constant; 138 ConstantValue constant = dependency.constant;
139 Expect.isFalse(compiledConstants.contains(constant), 139 Expect.isFalse(compiledConstants.contains(constant),
140 constant.toStructuredString()); 140 constant.toStructuredText());
141 } 141 }
142 142
143 // The type literal 'Foo' is both used as metadata, and as a plain value in 143 // The type literal 'Foo' is both used as metadata, and as a plain value in
144 // the program. Make sure that it isn't duplicated. 144 // the program. Make sure that it isn't duplicated.
145 int fooConstantCount = 0; 145 int fooConstantCount = 0;
146 for (ConstantValue constant in compiledConstants) { 146 for (ConstantValue constant in compiledConstants) {
147 if (constant is TypeConstantValue && 147 if (constant is TypeConstantValue &&
148 '${constant.representedType}' == 'Foo') { 148 '${constant.representedType}' == 'Foo') {
149 fooConstantCount++; 149 fooConstantCount++;
150 } 150 }
(...skipping 30 matching lines...) Expand all
181 library lib; 181 library lib;
182 182
183 import 'dart:mirrors'; 183 import 'dart:mirrors';
184 184
185 useReflect(type) { 185 useReflect(type) {
186 print(new Symbol('Foo')); 186 print(new Symbol('Foo'));
187 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName)); 187 print(MirrorSystem.getName(reflectClass(type).owner.qualifiedName));
188 } 188 }
189 """, 189 """,
190 }; 190 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/constant_expression_test.dart ('k') | tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698