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

Side by Side Diff: tests/compiler/dart2js/equivalence/check_helpers.dart

Issue 2913713004: Add model test of CodegenWorldBuilder to compile_from_dill_test (Closed)
Patch Set: So much patch set for so small a typo. Created 3 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /// General equivalence test functions. 5 /// General equivalence test functions.
6 6
7 library dart2js.equivalence.helpers; 7 library dart2js.equivalence.helpers;
8 8
9 import 'package:compiler/src/constants/expressions.dart'; 9 import 'package:compiler/src/constants/expressions.dart';
10 import 'package:compiler/src/constants/values.dart'; 10 import 'package:compiler/src/constants/values.dart';
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 print(message); 399 print(message);
400 } 400 }
401 } 401 }
402 402
403 String defaultToString(obj) => '$obj'; 403 String defaultToString(obj) => '$obj';
404 404
405 void checkMaps(Map map1, Map map2, String messagePrefix, bool sameKey(a, b), 405 void checkMaps(Map map1, Map map2, String messagePrefix, bool sameKey(a, b),
406 bool sameValue(a, b), 406 bool sameValue(a, b),
407 {bool failOnUnfound: true, 407 {bool failOnUnfound: true,
408 bool failOnMismatch: true, 408 bool failOnMismatch: true,
409 bool keyFilter(key),
409 bool verbose: false, 410 bool verbose: false,
410 String keyToString(key): defaultToString, 411 String keyToString(key): defaultToString,
411 String valueToString(key): defaultToString}) { 412 String valueToString(key): defaultToString}) {
412 List<List> common = <List>[]; 413 List<List> common = <List>[];
413 List unfound = []; 414 List unfound = [];
414 List<List> mismatch = <List>[]; 415 List<List> mismatch = <List>[];
415 Set remaining = computeSetDifference(map1.keys, map2.keys, common, unfound, 416
417 Iterable keys1 = map1.keys;
418 Iterable keys2 = map2.keys;
419 if (keyFilter != null) {
420 keys1 = keys1.where(keyFilter);
421 keys2 = keys2.where(keyFilter);
422 }
423 Set remaining = computeSetDifference(keys1, keys2, common, unfound,
416 sameElement: sameKey, checkElements: (k1, k2) { 424 sameElement: sameKey, checkElements: (k1, k2) {
417 var v1 = map1[k1]; 425 var v1 = map1[k1];
418 var v2 = map2[k2]; 426 var v2 = map2[k2];
419 if (!sameValue(v1, v2)) { 427 if (!sameValue(v1, v2)) {
420 mismatch.add([k1, k2]); 428 mismatch.add([k1, k2]);
421 } 429 }
422 }); 430 });
423 StringBuffer sb = new StringBuffer(); 431 StringBuffer sb = new StringBuffer();
424 sb.write("$messagePrefix:"); 432 sb.write("$messagePrefix:");
425 if (verbose) { 433 if (verbose) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 (mismatch.isNotEmpty && failOnMismatch) || 478 (mismatch.isNotEmpty && failOnMismatch) ||
471 remaining.isNotEmpty) { 479 remaining.isNotEmpty) {
472 Expect.fail(message); 480 Expect.fail(message);
473 } else { 481 } else {
474 print(message); 482 print(message);
475 } 483 }
476 } else if (verbose) { 484 } else if (verbose) {
477 print(message); 485 print(message);
478 } 486 }
479 } 487 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/equivalence/check_functions.dart ('k') | tests/compiler/dart2js/kernel/closed_world_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698