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

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

Issue 2850783002: Dart SDK Spelling b, c, and d. (Closed)
Patch Set: Created 3 years, 7 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library constant_expression_test; 5 library constant_expression_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:compiler/src/constants/expressions.dart'; 10 import 'package:compiler/src/constants/expressions.dart';
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 memorySourceFiles: {'main.dart': source}, options: ['--analyze-all']); 210 memorySourceFiles: {'main.dart': source}, options: ['--analyze-all']);
211 Compiler compiler = result.compiler; 211 Compiler compiler = result.compiler;
212 MemoryEnvironment environment = new MemoryEnvironment(compiler); 212 MemoryEnvironment environment = new MemoryEnvironment(compiler);
213 var library = compiler.mainApp; 213 var library = compiler.mainApp;
214 constants.forEach((String name, ConstantData data) { 214 constants.forEach((String name, ConstantData data) {
215 FieldElement field = library.localLookup(name); 215 FieldElement field = library.localLookup(name);
216 var constant = field.constant; 216 var constant = field.constant;
217 Expect.equals( 217 Expect.equals(
218 data.kind, 218 data.kind,
219 constant.kind, 219 constant.kind,
220 "Unexpected kind '${constant.kind}' for contant " 220 "Unexpected kind '${constant.kind}' for constant "
221 "`${constant.toDartText()}`, expected '${data.kind}'."); 221 "`${constant.toDartText()}`, expected '${data.kind}'.");
222 Expect.equals( 222 Expect.equals(
223 data.text, 223 data.text,
224 constant.toDartText(), 224 constant.toDartText(),
225 "Unexpected text '${constant.toDartText()}' for contant, " 225 "Unexpected text '${constant.toDartText()}' for constant, "
226 "expected '${data.text}'."); 226 "expected '${data.text}'.");
227 if (data.type != null) { 227 if (data.type != null) {
228 String instanceType = 228 String instanceType =
229 constant.computeInstanceType(environment).toString(); 229 constant.computeInstanceType(environment).toString();
230 Expect.equals( 230 Expect.equals(
231 data.type, 231 data.type,
232 instanceType, 232 instanceType,
233 "Unexpected type '$instanceType' for contant " 233 "Unexpected type '$instanceType' for constant "
234 "`${constant.toDartText()}`, expected '${data.type}'."); 234 "`${constant.toDartText()}`, expected '${data.type}'.");
235 } 235 }
236 if (data.fields != null) { 236 if (data.fields != null) {
237 Map instanceFields = constant.computeInstanceFields(environment); 237 Map instanceFields = constant.computeInstanceFields(environment);
238 Expect.equals( 238 Expect.equals(
239 data.fields.length, 239 data.fields.length,
240 instanceFields.length, 240 instanceFields.length,
241 "Unexpected field count ${instanceFields.length} for contant " 241 "Unexpected field count ${instanceFields.length} for constant "
242 "`${constant.toDartText()}`, expected '${data.fields.length}'."); 242 "`${constant.toDartText()}`, expected '${data.fields.length}'.");
243 instanceFields.forEach((field, expression) { 243 instanceFields.forEach((field, expression) {
244 String name = '$field'; 244 String name = '$field';
245 String expression = instanceFields[field].toDartText(); 245 String expression = instanceFields[field].toDartText();
246 String expected = data.fields[name]; 246 String expected = data.fields[name];
247 Expect.equals( 247 Expect.equals(
248 expected, 248 expected,
249 expression, 249 expression,
250 "Unexpected field expression ${expression} for field '$name' in " 250 "Unexpected field expression ${expression} for field '$name' in "
251 "contant `${constant.toDartText()}`, expected '${expected}'."); 251 "constant `${constant.toDartText()}`, expected '${expected}'.");
252 }); 252 });
253 } 253 }
254 }); 254 });
255 } 255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698