OLD | NEW |
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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 bare_name = OneByteString::New("foo.name"); | 2801 bare_name = OneByteString::New("foo.name"); |
2802 EXPECT(!mangled_name.EqualsIgnoringPrivateKey(bare_name)); | 2802 EXPECT(!mangled_name.EqualsIgnoringPrivateKey(bare_name)); |
2803 } | 2803 } |
2804 | 2804 |
2805 | 2805 |
2806 TEST_CASE(ArrayNew_Overflow_Crash) { | 2806 TEST_CASE(ArrayNew_Overflow_Crash) { |
2807 Array::Handle(Array::New(Array::kMaxElements + 1)); | 2807 Array::Handle(Array::New(Array::kMaxElements + 1)); |
2808 } | 2808 } |
2809 | 2809 |
2810 | 2810 |
| 2811 TEST_CASE(StackTraceFormat) { |
| 2812 const char* kScriptChars = |
| 2813 "void baz() {\n" |
| 2814 " throw 'MyException';\n" |
| 2815 "}\n" |
| 2816 "\n" |
| 2817 "class _OtherClass {\n" |
| 2818 " _OtherClass._named() {\n" |
| 2819 " baz();\n" |
| 2820 " }\n" |
| 2821 "}\n" |
| 2822 "\n" |
| 2823 "set globalVar(var value) {\n" |
| 2824 " new _OtherClass._named();\n" |
| 2825 "}\n" |
| 2826 "\n" |
| 2827 "void _bar() {\n" |
| 2828 " globalVar = null;\n" |
| 2829 "}\n" |
| 2830 "\n" |
| 2831 "class MyClass {\n" |
| 2832 " MyClass() {\n" |
| 2833 " (() => foo())();\n" |
| 2834 " }\n" |
| 2835 "\n" |
| 2836 " static get field() {\n" |
| 2837 " _bar();\n" |
| 2838 " }\n" |
| 2839 "\n" |
| 2840 " static foo() {\n" |
| 2841 " fooHelper() {\n" |
| 2842 " field;\n" |
| 2843 " }\n" |
| 2844 " fooHelper();\n" |
| 2845 " }\n" |
| 2846 "}\n" |
| 2847 "\n" |
| 2848 "main() {\n" |
| 2849 " (() => new MyClass())();\n" |
| 2850 "}\n"; |
| 2851 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 2852 EXPECT_VALID(lib); |
| 2853 Dart_Handle result = Dart_Invoke(lib, Dart_NewString("main"), 0, NULL); |
| 2854 EXPECT_ERROR( |
| 2855 result, |
| 2856 "Unhandled exception:\n" |
| 2857 "MyException\n" |
| 2858 "#0 baz (dart:test-lib:2:3)\n" |
| 2859 "#1 _OtherClass._OtherClass._named (dart:test-lib:7:8)\n" |
| 2860 "#2 globalVar= (dart:test-lib:12:3)\n" |
| 2861 "#3 _bar (dart:test-lib:16:3)\n" |
| 2862 "#4 MyClass.field (dart:test-lib:25:9)\n" |
| 2863 "#5 MyClass.foo.fooHelper (dart:test-lib:30:7)\n" |
| 2864 "#6 MyClass.foo (dart:test-lib:32:14)\n" |
| 2865 "#7 MyClass.MyClass.<anonymous closure> (dart:test-lib:21:15)\n" |
| 2866 "#8 MyClass.MyClass (dart:test-lib:21:18)\n" |
| 2867 "#9 main.<anonymous closure> (dart:test-lib:37:10)\n" |
| 2868 "#10 main (dart:test-lib:37:24)"); |
| 2869 } |
| 2870 |
2811 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2871 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
2812 | 2872 |
2813 } // namespace dart | 2873 } // namespace dart |
OLD | NEW |