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

Unified Diff: runtime/vm/debugger_api_impl_test.cc

Issue 219993004: Fix line number table generation for multiline strings with interpolation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: post code review Created 6 years, 9 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/vm/debugger_api_impl.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl_test.cc
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 99b7ad9dc6f7bb50e0d28d370e8ea67b513f564f..502cd7a9776cf2ceb264e5f3dd0624a7081275d0 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -2078,4 +2078,64 @@ TEST_CASE(Debug_ListSuperType) {
EXPECT(super_type == Dart_Null());
}
+TEST_CASE(Debug_ScriptGetTokenInfo_Basic) {
+ const char* kScriptChars =
+ "var foo;\n"
+ "\n"
+ "main() {\n"
+ "}";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ intptr_t libId = -1;
+ EXPECT_VALID(Dart_LibraryId(lib, &libId));
+ Dart_Handle scriptUrl = NewString(TestCase::url());
+ Dart_Handle tokens = Dart_ScriptGetTokenInfo(libId, scriptUrl);
+ EXPECT_VALID(tokens);
+
+ Dart_Handle tokens_string = Dart_ToString(tokens);
+ EXPECT_VALID(tokens_string);
+ const char* tokens_cstr = "";
+ EXPECT_VALID(Dart_StringToCString(tokens_string, &tokens_cstr));
+ EXPECT_STREQ(
+ "[null, 1, 0, 1, 1, 5, 2, 8,"
+ " null, 3, 5, 1, 6, 5, 7, 6, 8, 8,"
+ " null, 4, 10, 1]",
+ tokens_cstr);
+}
+
+TEST_CASE(Debug_ScriptGetTokenInfo_MultiLineInterpolation) {
+ const char* kScriptChars =
+ "var foo = 'hello world';\n"
+ "\n"
+ "void test() {\n"
+ " return '''\n"
+ "foo=$foo"
+ "''';\n"
+ "}\n"
+ "\n"
+ "main() {\n"
+ "}";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ intptr_t libId = -1;
+ EXPECT_VALID(Dart_LibraryId(lib, &libId));
+ Dart_Handle scriptUrl = NewString(TestCase::url());
+ Dart_Handle tokens = Dart_ScriptGetTokenInfo(libId, scriptUrl);
+ EXPECT_VALID(tokens);
+
+ Dart_Handle tokens_string = Dart_ToString(tokens);
+ EXPECT_VALID(tokens_string);
+ const char* tokens_cstr = "";
+ EXPECT_VALID(Dart_StringToCString(tokens_string, &tokens_cstr));
+ EXPECT_STREQ(
+ "[null, 1, 0, 1, 1, 5, 2, 9, 3, 11, 4, 24,"
+ " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13,"
+ " null, 4, 13, 3, 14, 10,"
+ " null, 5, 17, 5, 18, 9, 19, 12,"
+ " null, 6, 21, 1,"
+ " null, 8, 24, 1, 25, 5, 26, 6, 27, 8,"
+ " null, 9, 29, 1]",
+ tokens_cstr);
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698