OLD | NEW |
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:io'; | 7 import 'dart:io'; |
8 import 'memory_compiler.dart'; | 8 import 'memory_compiler.dart'; |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:compiler/src/common/resolution.dart'; | 10 import 'package:compiler/src/common/resolution.dart'; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return checkConstantLists(object1, object2, property, list1, list2); | 98 return checkConstantLists(object1, object2, property, list1, list2); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 /// Check that the values [property] of [object1] and [object2], [value1] and | 102 /// Check that the values [property] of [object1] and [object2], [value1] and |
103 /// [value2] respectively, are equal and throw otherwise. | 103 /// [value2] respectively, are equal and throw otherwise. |
104 bool check(var object1, var object2, String property, var value1, var value2, | 104 bool check(var object1, var object2, String property, var value1, var value2, |
105 [bool equivalence(a, b) = equality]) { | 105 [bool equivalence(a, b) = equality]) { |
106 if (!equivalence(value1, value2)) { | 106 if (!equivalence(value1, value2)) { |
107 throw "property='$property'\n " | 107 throw "property='$property'\n " |
108 "object1=$object1 (${object1.runtimeType})\n value='${value1}' <>\n " | 108 "object1=$object1 (${object1.runtimeType})\n " |
109 "object2=$object2 (${object2.runtimeType})\n value='${value2}'"; | 109 "value=${value1 == null ? "null" : "'$value1'"} " |
| 110 "(${value1.runtimeType}) <>\n " |
| 111 "object2=$object2 (${object2.runtimeType})\n " |
| 112 "value=${value2 == null ? "null" : "'$value2'"} " |
| 113 "(${value2.runtimeType})"; |
110 } | 114 } |
111 return true; | 115 return true; |
112 } | 116 } |
113 | 117 |
114 /// Check equivalence of the two lists, [list1] and [list2], using | 118 /// Check equivalence of the two lists, [list1] and [list2], using |
115 /// [checkEquivalence] to check the pair-wise equivalence. | 119 /// [checkEquivalence] to check the pair-wise equivalence. |
116 /// | 120 /// |
117 /// Uses [object1], [object2] and [property] to provide context for failures. | 121 /// Uses [object1], [object2] and [property] to provide context for failures. |
118 bool checkListEquivalence( | 122 bool checkListEquivalence( |
119 Object object1, Object object2, String property, | 123 Object object1, Object object2, String property, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 373 |
370 if (impact1 == null) { | 374 if (impact1 == null) { |
371 throw 'Missing impact for $member1. $member2 has $impact2'; | 375 throw 'Missing impact for $member1. $member2 has $impact2'; |
372 } | 376 } |
373 if (impact2 == null) { | 377 if (impact2 == null) { |
374 throw 'Missing impact for $member2. $member1 has $impact1'; | 378 throw 'Missing impact for $member2. $member1 has $impact1'; |
375 } | 379 } |
376 | 380 |
377 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy()); | 381 testResolutionImpactEquivalence(impact1, impact2, const CheckStrategy()); |
378 } | 382 } |
OLD | NEW |