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

Side by Side 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: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/thread.h" 9 #include "vm/thread.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 EXPECT(Dart_IsList(list_access_test_obj)); 2071 EXPECT(Dart_IsList(list_access_test_obj));
2072 2072
2073 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); 2073 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj);
2074 Dart_Handle super_type = Dart_GetSupertype(list_type); 2074 Dart_Handle super_type = Dart_GetSupertype(list_type);
2075 EXPECT(!Dart_IsError(super_type)); 2075 EXPECT(!Dart_IsError(super_type));
2076 super_type = Dart_GetSupertype(super_type); 2076 super_type = Dart_GetSupertype(super_type);
2077 EXPECT(!Dart_IsError(super_type)); 2077 EXPECT(!Dart_IsError(super_type));
2078 EXPECT(super_type == Dart_Null()); 2078 EXPECT(super_type == Dart_Null());
2079 } 2079 }
2080 2080
2081 TEST_CASE(Debug_ScriptGetTokenInfo_Basic) {
2082 const char* kScriptChars =
2083 "var foo;\n"
2084 "\n"
2085 "main() {\n"
2086 "}";
2087
2088 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2089 intptr_t libId = -1;
2090 EXPECT_VALID(Dart_LibraryId(lib, &libId));
2091 Dart_Handle scriptUrl = NewString(TestCase::url());
2092 Dart_Handle tokens = Dart_ScriptGetTokenInfo(libId, scriptUrl);
2093 EXPECT_VALID(tokens);
2094
2095 Dart_Handle tokens_string = Dart_ToString(tokens);
2096 EXPECT_VALID(tokens_string);
2097 const char* tokens_cstr = "";
2098 EXPECT_VALID(Dart_StringToCString(tokens_string, &tokens_cstr));
2099 EXPECT_STREQ(
2100 "[null, 1, 0, 1, 1, 5, 2, 8,"
2101 " null, 3, 5, 1, 6, 5, 7, 6, 8, 8,"
2102 " null, 4, 10, 1]",
2103 tokens_cstr);
2104 }
2105
2106 TEST_CASE(Debug_ScriptGetTokenInfo_MultiLineInterpolation) {
2107 const char* kScriptChars =
2108 "var foo = 'hello world';\n"
2109 "\n"
2110 "void test() {\n"
2111 " return '''\n"
2112 "foo=$foo"
2113 "''';\n"
2114 "}\n"
2115 "\n"
2116 "main() {\n"
2117 "}";
2118
2119 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2120 intptr_t libId = -1;
2121 EXPECT_VALID(Dart_LibraryId(lib, &libId));
2122 Dart_Handle scriptUrl = NewString(TestCase::url());
2123 Dart_Handle tokens = Dart_ScriptGetTokenInfo(libId, scriptUrl);
2124 EXPECT_VALID(tokens);
2125
2126 Dart_Handle tokens_string = Dart_ToString(tokens);
2127 EXPECT_VALID(tokens_string);
2128 const char* tokens_cstr = "";
2129 EXPECT_VALID(Dart_StringToCString(tokens_string, &tokens_cstr));
2130 EXPECT_STREQ(
2131 "[null, 1, 0, 1, 1, 5, 2, 9, 3, 11, 4, 24,"
2132 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13,"
2133 " null, 4, 13, 3, 14, 10,"
2134 " null, 5, 17, 5, 18, 9, 19, 12,"
2135 " null, 6, 21, 1,"
2136 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8,"
2137 " null, 9, 29, 1]",
2138 tokens_cstr);
2139 }
2140
2081 } // namespace dart 2141 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger_api_impl.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698