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

Unified Diff: runtime/vm/object_test.cc

Issue 1368773002: Modify String::IdentifierPrettyName to work with zone allocated temporary strings instead of String… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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') | no next file » | 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 c7ddd97e67df40f47f1fdbd625667a0a1e528236..23bc106676b7b548cdb03a156ea15fc532f9610f 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -4758,4 +4758,36 @@ TEST_CASE(Symbols_FromConcatAll) {
}
}
+
+struct TestResult {
+ const char* in;
+ const char* out;
+};
+
+
+TEST_CASE(String_IdentifierPrettyName) {
+ TestResult tests[] = {
+ {"(dynamic, dynamic) => void", "(dynamic, dynamic) => void"},
+ {"_List@915557746", "_List"},
+ {"_HashMap@600006304<K, V>(dynamic) => V", "_HashMap<K, V>(dynamic) => V"},
+ {"set:foo", "foo="},
+ {"get:foo", "foo"},
+ {"_ReceivePortImpl@709387912", "_ReceivePortImpl"},
+ {"_ReceivePortImpl@709387912._internal@709387912",
+ "_ReceivePortImpl._internal"},
+ {"_C@6328321&_E@6328321&_F@6328321", "_C&_E&_F"},
+ {"List.", "List"},
+ {"get:foo@6328321", "foo"},
+ {"_MyClass@6328321.", "_MyClass"},
+ {"_MyClass@6328321.named", "_MyClass.named"},
+ };
+ String& test = String::Handle();
+ String& result = String::Handle();
+ for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
+ test = String::New(tests[i].in);
+ result = String::IdentifierPrettyName(test);
+ EXPECT_STREQ(tests[i].out, result.ToCString());
+ }
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698