OLD | NEW |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 @override | 82 @override |
83 bool testLists( | 83 bool testLists( |
84 Object object1, Object object2, String property, List list1, List list2, | 84 Object object1, Object object2, String property, List list1, List list2, |
85 [bool elementEquivalence(a, b) = equality]) { | 85 [bool elementEquivalence(a, b) = equality]) { |
86 return checkListEquivalence(object1, object2, property, list1, list2, | 86 return checkListEquivalence(object1, object2, property, list1, list2, |
87 (o1, o2, p, v1, v2) { | 87 (o1, o2, p, v1, v2) { |
88 if (!elementEquivalence(v1, v2)) { | 88 if (!elementEquivalence(v1, v2)) { |
89 throw "$o1.$p = '${v1}' <> " | 89 throw "$o1.$p = '${v1}' <> " |
90 "$o2.$p = '${v2}'"; | 90 "$o2.$p = '${v2}'"; |
91 } | 91 } |
92 return true; | |
93 }); | 92 }); |
94 } | 93 } |
95 | 94 |
96 @override | 95 @override |
97 bool testSets( | 96 bool testSets( |
98 var object1, var object2, String property, Iterable set1, Iterable set2, | 97 var object1, var object2, String property, Iterable set1, Iterable set2, |
99 [bool elementEquivalence(a, b) = equality]) { | 98 [bool elementEquivalence(a, b) = equality]) { |
100 return checkSetEquivalence( | 99 return checkSetEquivalence( |
101 object1, object2, property, set1, set2, elementEquivalence); | 100 object1, object2, property, set1, set2, elementEquivalence); |
102 } | 101 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 (mismatch.isNotEmpty && failOnMismatch) || | 476 (mismatch.isNotEmpty && failOnMismatch) || |
478 remaining.isNotEmpty) { | 477 remaining.isNotEmpty) { |
479 Expect.fail(message); | 478 Expect.fail(message); |
480 } else { | 479 } else { |
481 print(message); | 480 print(message); |
482 } | 481 } |
483 } else if (verbose) { | 482 } else if (verbose) { |
484 print(message); | 483 print(message); |
485 } | 484 } |
486 } | 485 } |
OLD | NEW |