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

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 3002833003: Adjust the column number where a StackOverflow error is reported. (Closed)
Patch Set: fix typos Created 3 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 | « runtime/tests/vm/vm.status ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl_test.cc
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index be2415b5f76d61f0e6ee6a21d51bbc486f8193a8..8233cde70634745f69f21c5cc5d94ddbe8879975 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -213,15 +213,13 @@ TEST_CASE(DartAPI_DeepStackTraceInfo) {
EXPECT(Dart_IsError(result));
}
-TEST_CASE(DartAPI_StackOverflowStackTraceInfo) {
- const char* kScriptChars =
- "class C {\n"
- " static foo() => foo();\n"
- "}\n"
- "testMain() => C.foo();\n";
-
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle error = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
+void VerifyStackOverflowStackTraceInfo(const char* script,
+ const char* top_frame_func_name,
+ const char* entry_func_name,
+ int expected_line_number,
+ int expected_column_number) {
+ Dart_Handle lib = TestCase::LoadTestScript(script, NULL);
+ Dart_Handle error = Dart_Invoke(lib, NewString(entry_func_name), 0, NULL);
EXPECT(Dart_IsError(error));
@@ -248,11 +246,11 @@ TEST_CASE(DartAPI_StackOverflowStackTraceInfo) {
&line_number, &column_number);
EXPECT_VALID(result);
Dart_StringToCString(function_name, &cstr);
- EXPECT_STREQ("C.foo", cstr);
+ EXPECT_STREQ(top_frame_func_name, cstr);
Dart_StringToCString(script_url, &cstr);
EXPECT_STREQ("test-lib", cstr);
- EXPECT_EQ(2, line_number);
- EXPECT_EQ(13, column_number);
+ EXPECT_EQ(expected_line_number, line_number);
+ EXPECT_EQ(expected_column_number, column_number);
// Out-of-bounds frames.
result = Dart_GetActivationFrame(stacktrace, frame_count, &frame);
@@ -261,6 +259,35 @@ TEST_CASE(DartAPI_StackOverflowStackTraceInfo) {
EXPECT(Dart_IsError(result));
}
+TEST_CASE(DartAPI_StackOverflowStackTraceInfoBraceFunction1) {
+ VerifyStackOverflowStackTraceInfo(
+ "class C {\n"
+ " static foo(int i) { foo(i); }\n"
+ "}\n"
+ "testMain() => C.foo(10);\n",
+ "C.foo", "testMain", 2, 21);
+}
+
+TEST_CASE(DartAPI_StackOverflowStackTraceInfoBraceFunction2) {
+ VerifyStackOverflowStackTraceInfo(
+ "class C {\n"
+ " static foo(int i, int j) {\n"
+ " foo(i, j);\n"
+ " }\n"
+ "}\n"
+ "testMain() => C.foo(10, 11);\n",
+ "C.foo", "testMain", 2, 28);
+}
+
+TEST_CASE(DartAPI_StackOverflowStackTraceInfoArrowFunction) {
+ VerifyStackOverflowStackTraceInfo(
+ "class C {\n"
+ " static foo(int i) => foo(i);\n"
+ "}\n"
+ "testMain() => C.foo(10);\n",
+ "C.foo", "testMain", 2, 21);
+}
+
TEST_CASE(DartAPI_OutOfMemoryStackTraceInfo) {
const char* kScriptChars =
"var number_of_ints = 134000000;\n"
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698