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

Unified Diff: tests/lib/mirrors/equality_dart2js_test.dart

Issue 23460013: Implement InstanceMirror.== in dart2js and InstanceMirror.hashCode in the VM and … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: use isolate parameter to native Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/equality_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/equality_dart2js_test.dart
diff --git a/tests/lib/mirrors/equality_test.dart b/tests/lib/mirrors/equality_dart2js_test.dart
similarity index 73%
copy from tests/lib/mirrors/equality_test.dart
copy to tests/lib/mirrors/equality_dart2js_test.dart
index 2399032fc4aabedd38a66c6e2342633b8a1b7afe..15c036d4143105d515659b7352581902794ea427 100644
--- a/tests/lib/mirrors/equality_test.dart
+++ b/tests/lib/mirrors/equality_dart2js_test.dart
@@ -11,6 +11,12 @@ import 'package:expect/expect.dart';
class A<T> {}
class B extends A<int> {}
+class BadEqualityHash {
+ int count = 0;
+ bool operator ==(other) => true;
+ int get hashCode => count++;
+}
+
checkEquality(List<Map> equivalenceClasses) {
for (var equivalenceClass in equivalenceClasses) {
equivalenceClass.forEach((name, member) {
@@ -45,8 +51,11 @@ main() {
.findLibrary(const Symbol('test.class_equality_test'))
.single;
- Object o1 = new Object();
- Object o2 = new Object();
+ var o1 = new Object();
+ var o2 = new Object();
+
+ var badEqualityHash1 = new BadEqualityHash();
+ var badEqualityHash2 = new BadEqualityHash();
checkEquality([
{'reflect(o1)' : reflect(o1),
@@ -55,12 +64,31 @@ main() {
{'reflect(o2)' : reflect(o2),
'reflect(o2), again' : reflect(o2)},
+ {'reflect(badEqualityHash1)' : reflect(badEqualityHash1),
+ 'reflect(badEqualityHash1), again' : reflect(badEqualityHash1)},
+
+ {'reflect(badEqualityHash2)' : reflect(badEqualityHash2),
+ 'reflect(badEqualityHash2), again' : reflect(badEqualityHash2)},
+
+ {'reflect(true)' : reflect(true),
+ 'reflect(true), again' : reflect(true)},
+
+ {'reflect(false)' : reflect(false),
+ 'reflect(false), again' : reflect(false)},
+
+ {'reflect(null)' : reflect(null),
+ 'reflect(null), again' : reflect(null)},
+
+ {'reflect(3.5+4.5)' : reflect(3.5+4.5),
+ 'reflect(6.5+1.5)' : reflect(6.5+1.5)},
+
{'reflect(3+4)' : reflect(3+4),
'reflect(6+1)' : reflect(6+1)},
- {'currentMirrorSystem().voidType' : currentMirrorSystem().voidType,
- 'thisLibrary.functions[#subroutine].returnType' :
- thisLibrary.functions[const Symbol('subroutine')].returnType},
+ {'reflect("foo")' : reflect("foo"),
+ 'reflect("foo"), again' : reflect("foo")},
+
+ {'currentMirrorSystem().voidType' : currentMirrorSystem().voidType},
{'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType,
'thisLibrary.functions[#main].returnType' :
@@ -71,9 +99,6 @@ main() {
'reflect(new A<int>()).type.originalDeclaration' :
reflect(new A<int>()).type.originalDeclaration},
- {'reflectClass(B).superclass' : reflectClass(B).superclass,
- 'reflect(new A<int>()).type' : reflect(new A<int>()).type},
-
{'reflectClass(B)' : reflectClass(B),
'thisLibrary.classes[#B]' : thisLibrary.classes[const Symbol('B')],
'reflect(new B()).type' : reflect(new B()).type},
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/equality_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698