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

Side by Side Diff: vm/dart_api_impl_test.cc

Issue 10826191: Improve the stack trace output to be more readable. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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 | « vm/dart_api_impl.cc ('k') | vm/object.h » ('j') | no next file with comments »
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 "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 28 matching lines...) Expand all
39 39
40 EXPECT(!Dart_ErrorHasException(instance)); 40 EXPECT(!Dart_ErrorHasException(instance));
41 EXPECT(!Dart_ErrorHasException(error)); 41 EXPECT(!Dart_ErrorHasException(error));
42 EXPECT(Dart_ErrorHasException(exception)); 42 EXPECT(Dart_ErrorHasException(exception));
43 43
44 EXPECT_STREQ("", Dart_GetError(instance)); 44 EXPECT_STREQ("", Dart_GetError(instance));
45 EXPECT_STREQ("myerror", Dart_GetError(error)); 45 EXPECT_STREQ("myerror", Dart_GetError(error));
46 EXPECT_STREQ( 46 EXPECT_STREQ(
47 "Unhandled exception:\n" 47 "Unhandled exception:\n"
48 "Exception: bad news\n" 48 "Exception: bad news\n"
49 " 0. Function: '::testMain' url: 'dart:test-lib' line:2 col:3", 49 "#0 testMain (dart:test-lib:2:3)",
50 Dart_GetError(exception)); 50 Dart_GetError(exception));
51 51
52 EXPECT(Dart_IsError(Dart_ErrorGetException(instance))); 52 EXPECT(Dart_IsError(Dart_ErrorGetException(instance)));
53 EXPECT(Dart_IsError(Dart_ErrorGetException(error))); 53 EXPECT(Dart_IsError(Dart_ErrorGetException(error)));
54 EXPECT_VALID(Dart_ErrorGetException(exception)); 54 EXPECT_VALID(Dart_ErrorGetException(exception));
55 55
56 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(instance))); 56 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(instance)));
57 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(error))); 57 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(error)));
58 EXPECT_VALID(Dart_ErrorGetStacktrace(exception)); 58 EXPECT_VALID(Dart_ErrorGetStacktrace(exception));
59 } 59 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 TEST_CASE(InstanceGetClass) { 250 TEST_CASE(InstanceGetClass) {
251 // Get the handle from a valid instance handle. 251 // Get the handle from a valid instance handle.
252 Dart_Handle instance = Dart_True(); 252 Dart_Handle instance = Dart_True();
253 Dart_Handle cls = Dart_InstanceGetClass(instance); 253 Dart_Handle cls = Dart_InstanceGetClass(instance);
254 EXPECT_VALID(cls); 254 EXPECT_VALID(cls);
255 EXPECT(Dart_IsClass(cls)); 255 EXPECT(Dart_IsClass(cls));
256 Dart_Handle cls_name = Dart_ClassName(cls); 256 Dart_Handle cls_name = Dart_ClassName(cls);
257 EXPECT_VALID(cls_name); 257 EXPECT_VALID(cls_name);
258 const char* cls_name_cstr = ""; 258 const char* cls_name_cstr = "";
259 EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr)); 259 EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr));
260 EXPECT_STREQ("Bool", cls_name_cstr); 260 EXPECT_STREQ("bool", cls_name_cstr);
261 261
262 // Errors propagate. 262 // Errors propagate.
263 Dart_Handle error = Dart_NewApiError("MyError"); 263 Dart_Handle error = Dart_NewApiError("MyError");
264 Dart_Handle error_cls = Dart_InstanceGetClass(error); 264 Dart_Handle error_cls = Dart_InstanceGetClass(error);
265 EXPECT_ERROR(error_cls, "MyError"); 265 EXPECT_ERROR(error_cls, "MyError");
266 266
267 // Get the handle from a non-instance handle 267 // Get the handle from a non-instance handle
268 ASSERT(Dart_IsClass(cls)); 268 ASSERT(Dart_IsClass(cls));
269 Dart_Handle cls_cls = Dart_InstanceGetClass(cls); 269 Dart_Handle cls_cls = Dart_InstanceGetClass(cls);
270 EXPECT_ERROR(cls_cls, 270 EXPECT_ERROR(cls_cls,
(...skipping 6252 matching lines...) Expand 10 before | Expand all | Expand 10 after
6523 EXPECT(Dart_IsString(str)); 6523 EXPECT(Dart_IsString(str));
6524 len = -1; 6524 len = -1;
6525 EXPECT_VALID(Dart_StringLength(str, &len)); 6525 EXPECT_VALID(Dart_StringLength(str, &len));
6526 EXPECT_EQ(0, len); 6526 EXPECT_EQ(0, len);
6527 } 6527 }
6528 6528
6529 6529
6530 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 6530 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
6531 6531
6532 } // namespace dart 6532 } // namespace dart
OLDNEW
« no previous file with comments | « vm/dart_api_impl.cc ('k') | vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698