| 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
|
|
|