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

Unified Diff: runtime/vm/object_test.cc

Issue 361743002: observatory/vm: add support for computing/passing end tokens on classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix polymer include and add deployed/ Created 6 years, 6 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/object.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 5ccc8d4c847e27504cba05b936e9a60f8a8f87ec..3cb1beb453516dc30761aaa2174794047863a41f 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -221,6 +221,35 @@ TEST_CASE(GenerateExactSource) {
}
+TEST_CASE(Class_ComputeEndTokenPos) {
+ const char* kScript =
+ "\n"
+ "class A {\n"
+ " /**\n"
+ " * Description of foo().\n"
+ " */\n"
+ " foo(a) { return '''\"}'''; }\n"
+ " // }\n"
+ " var bar = '\\'}';\n"
+ " var baz = \"${foo('}')}\";\n"
+ "}\n";
+ Dart_Handle lib_h = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib_h);
+ Library& lib = Library::Handle();
+ lib ^= Api::UnwrapHandle(lib_h);
+ EXPECT(!lib.IsNull());
+ const Class& cls = Class::Handle(
+ lib.LookupClass(String::Handle(String::New("A"))));
+ EXPECT(!cls.IsNull());
+ const intptr_t end_token_pos = cls.ComputeEndTokenPos();
+ const Script& scr = Script::Handle(cls.script());
+ intptr_t line;
+ intptr_t col;
+ scr.GetTokenLocation(end_token_pos, &line, &col);
+ EXPECT(line == 10 && col == 1);
+}
+
+
TEST_CASE(InstanceClass) {
// Allocate the class first.
String& class_name = String::Handle(Symbols::New("EmptyClass"));
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698