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

Side by Side Diff: tests/compiler/dart2js/serialization/test_helper.dart

Issue 2060183002: Serialize metadata (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 4 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
« no previous file with comments | « tests/compiler/dart2js/serialization/model_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 dart2js.serialization_test_helper; 5 library dart2js.serialization_test_helper;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'package:compiler/src/common/resolution.dart'; 8 import 'package:compiler/src/common/resolution.dart';
9 import 'package:compiler/src/constants/expressions.dart'; 9 import 'package:compiler/src/constants/expressions.dart';
10 import 'package:compiler/src/dart_types.dart'; 10 import 'package:compiler/src/dart_types.dart';
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 429
430 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy()); 430 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy());
431 } 431 }
432 432
433 void checkSets( 433 void checkSets(
434 Iterable set1, 434 Iterable set1,
435 Iterable set2, 435 Iterable set2,
436 String messagePrefix, 436 String messagePrefix,
437 bool sameElement(a, b), 437 bool sameElement(a, b),
438 {bool failOnUnfound: true, 438 {bool failOnUnfound: true,
439 bool failOnExtra: true,
439 bool verbose: false, 440 bool verbose: false,
440 void onSameElement(a, b)}) { 441 void onSameElement(a, b)}) {
441 List<List> common = <List>[]; 442 List<List> common = <List>[];
442 List unfound = []; 443 List unfound = [];
443 Set remaining = computeSetDifference( 444 Set remaining = computeSetDifference(
444 set1, set2, common, unfound, 445 set1, set2, common, unfound,
445 sameElement: sameElement, 446 sameElement: sameElement,
446 checkElements: onSameElement); 447 checkElements: onSameElement);
447 StringBuffer sb = new StringBuffer(); 448 StringBuffer sb = new StringBuffer();
448 sb.write("$messagePrefix:"); 449 sb.write("$messagePrefix:");
449 if (verbose) { 450 if (verbose) {
450 sb.write("\n Common:\n ${common.join('\n ')}"); 451 sb.write("\n Common:\n ${common.join('\n ')}");
451 } 452 }
452 if (unfound.isNotEmpty || verbose) { 453 if (unfound.isNotEmpty || verbose) {
453 sb.write("\n Unfound:\n ${unfound.join('\n ')}"); 454 sb.write("\n Unfound:\n ${unfound.join('\n ')}");
454 } 455 }
455 if (remaining.isNotEmpty || verbose) { 456 if (remaining.isNotEmpty || verbose) {
456 sb.write("\n Extra: \n ${remaining.join('\n ')}"); 457 sb.write("\n Extra: \n ${remaining.join('\n ')}");
457 } 458 }
458 String message = sb.toString(); 459 String message = sb.toString();
459 if (unfound.isNotEmpty || remaining.isNotEmpty) { 460 if (unfound.isNotEmpty || remaining.isNotEmpty) {
460 461
461 if (failOnUnfound || remaining.isNotEmpty) { 462 if ((failOnUnfound && unfound.isNotEmpty) ||
463 (failOnExtra && remaining.isNotEmpty)) {
462 Expect.fail(message); 464 Expect.fail(message);
463 } else { 465 } else {
464 print(message); 466 print(message);
465 } 467 }
466 } else if (verbose) { 468 } else if (verbose) {
467 print(message); 469 print(message);
468 } 470 }
469 } 471 }
470 472
471 String defaultToString(obj) => '$obj'; 473 String defaultToString(obj) => '$obj';
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 (mismatch.isNotEmpty && failOnMismatch) || 546 (mismatch.isNotEmpty && failOnMismatch) ||
545 remaining.isNotEmpty) { 547 remaining.isNotEmpty) {
546 Expect.fail(message); 548 Expect.fail(message);
547 } else { 549 } else {
548 print(message); 550 print(message);
549 } 551 }
550 } else if (verbose) { 552 } else if (verbose) {
551 print(message); 553 print(message);
552 } 554 }
553 } 555 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization/model_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698