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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 23464073: Make Dart_IdentityEqual live up to its spec and not leak boxing implementation detail. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index dda6809dc72af6c8745a7d7ab9d9d7b399a4024b..0646f1ccb2de99bf3bf257d0f84d49abc4fe7b13 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -199,6 +199,11 @@ TEST_CASE(IdentityEquals) {
// Different objects.
EXPECT(!Dart_IdentityEquals(five, seven));
+ // Case where identical() is not the same as pointer equality.
+ Dart_Handle nan1 = Dart_NewDouble(0.0/0.0);
+ Dart_Handle nan2 = Dart_NewDouble(0.0/0.0);
+ EXPECT(Dart_IdentityEquals(nan1, nan2));
+
// Non-instance objects.
{
Isolate* isolate = Isolate::Current();
@@ -209,6 +214,10 @@ TEST_CASE(IdentityEquals) {
EXPECT(Dart_IdentityEquals(class1, class1));
EXPECT(!Dart_IdentityEquals(class1, class2));
+
+ // Mix instance and non-instance.
+ EXPECT(!Dart_IdentityEquals(class1, nan1));
+ EXPECT(!Dart_IdentityEquals(nan1, class1));
}
}
@@ -230,6 +239,11 @@ TEST_CASE(ObjectEquals) {
// Different objects.
EXPECT_VALID(Dart_ObjectEquals(five, seven, &equal));
EXPECT(!equal);
+
+ // Case where == is not the same as pointer equality.
+ Dart_Handle nan = Dart_NewDouble(0.0/0.0);
+ EXPECT_VALID(Dart_ObjectEquals(nan, nan, &equal));
+ EXPECT(!equal);
}
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698