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

Unified Diff: vm/object_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/object.cc ('k') | vm/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object_test.cc
===================================================================
--- vm/object_test.cc (revision 10396)
+++ vm/object_test.cc (working copy)
@@ -2808,6 +2808,66 @@
}
+TEST_CASE(StackTraceFormat) {
+ const char* kScriptChars =
+ "void baz() {\n"
+ " throw 'MyException';\n"
+ "}\n"
+ "\n"
+ "class _OtherClass {\n"
+ " _OtherClass._named() {\n"
+ " baz();\n"
+ " }\n"
+ "}\n"
+ "\n"
+ "set globalVar(var value) {\n"
+ " new _OtherClass._named();\n"
+ "}\n"
+ "\n"
+ "void _bar() {\n"
+ " globalVar = null;\n"
+ "}\n"
+ "\n"
+ "class MyClass {\n"
+ " MyClass() {\n"
+ " (() => foo())();\n"
+ " }\n"
+ "\n"
+ " static get field() {\n"
+ " _bar();\n"
+ " }\n"
+ "\n"
+ " static foo() {\n"
+ " fooHelper() {\n"
+ " field;\n"
+ " }\n"
+ " fooHelper();\n"
+ " }\n"
+ "}\n"
+ "\n"
+ "main() {\n"
+ " (() => new MyClass())();\n"
+ "}\n";
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ EXPECT_VALID(lib);
+ Dart_Handle result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL);
+ EXPECT_ERROR(
+ result,
+ "Unhandled exception:\n"
+ "MyException\n"
+ "#0 baz (dart:test-lib:2:3)\n"
+ "#1 _OtherClass._OtherClass._named (dart:test-lib:7:8)\n"
+ "#2 globalVar= (dart:test-lib:12:3)\n"
+ "#3 _bar (dart:test-lib:16:3)\n"
+ "#4 MyClass.field (dart:test-lib:25:9)\n"
+ "#5 MyClass.foo.fooHelper (dart:test-lib:30:7)\n"
+ "#6 MyClass.foo (dart:test-lib:32:14)\n"
+ "#7 MyClass.MyClass.<anonymous closure> (dart:test-lib:21:15)\n"
+ "#8 MyClass.MyClass (dart:test-lib:21:18)\n"
+ "#9 main.<anonymous closure> (dart:test-lib:37:10)\n"
+ "#10 main (dart:test-lib:37:24)");
+}
+
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
} // namespace dart
« no previous file with comments | « vm/object.cc ('k') | vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698