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

Side by Side Diff: runtime/vm/exceptions_test.cc

Issue 274333002: Instance equality (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 12
13 #define FUNCTION_NAME(name) UnhandledExcp_##name 13 #define FUNCTION_NAME(name) UnhandledExcp_##name
14 #define REGISTER_FUNCTION(name, count) \ 14 #define REGISTER_FUNCTION(name, count) \
15 { ""#name, FUNCTION_NAME(name), count }, 15 { ""#name, FUNCTION_NAME(name), count },
16 16
17 17
18 void FUNCTION_NAME(Unhandled_equals)(Dart_NativeArguments args) { 18 void FUNCTION_NAME(Unhandled_equals)(Dart_NativeArguments args) {
19 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 19 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
20 const Instance& expected = Instance::CheckedHandle(arguments->NativeArgAt(0)); 20 const Instance& expected = Instance::CheckedHandle(arguments->NativeArgAt(0));
21 const Instance& actual = Instance::CheckedHandle(arguments->NativeArgAt(1)); 21 const Instance& actual = Instance::CheckedHandle(arguments->NativeArgAt(1));
22 if (!expected.Equals(actual)) { 22 if (!expected.CanonicalizeEquals(actual)) {
23 OS::Print("expected: '%s' actual: '%s'\n", 23 OS::Print("expected: '%s' actual: '%s'\n",
24 expected.ToCString(), actual.ToCString()); 24 expected.ToCString(), actual.ToCString());
25 FATAL("Unhandled_equals fails.\n"); 25 FATAL("Unhandled_equals fails.\n");
26 } 26 }
27 } 27 }
28 28
29 29
30 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { 30 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) {
31 // Invoke the specified entry point. 31 // Invoke the specified entry point.
32 Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second")); 32 Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second"));
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 " UnhandledExceptions.equals(2, Second.method1(1));\n" 126 " UnhandledExceptions.equals(2, Second.method1(1));\n"
127 " UnhandledExceptions.equals(3, Second.method3(1));\n" 127 " UnhandledExceptions.equals(3, Second.method3(1));\n"
128 "}"; 128 "}";
129 Dart_Handle lib = TestCase::LoadTestScript( 129 Dart_Handle lib = TestCase::LoadTestScript(
130 kScriptChars, 130 kScriptChars,
131 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 131 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
132 EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL)); 132 EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL));
133 } 133 }
134 134
135 } // namespace dart 135 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698