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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 4740 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 4751
4752 { 4752 {
4753 const String& empty = String::Handle(String::New("")); 4753 const String& empty = String::Handle(String::New(""));
4754 const String* data[3] = { &Symbols::FallThroughError(), 4754 const String* data[3] = { &Symbols::FallThroughError(),
4755 &empty, 4755 &empty,
4756 &Symbols::isPaused() }; 4756 &Symbols::isPaused() };
4757 CheckConcatAll(data, 3); 4757 CheckConcatAll(data, 3);
4758 } 4758 }
4759 } 4759 }
4760 4760
4761
4762 struct TestResult {
4763 const char* in;
4764 const char* out;
4765 };
4766
4767
4768 TEST_CASE(String_IdentifierPrettyName) {
4769 TestResult tests[] = {
4770 {"(dynamic, dynamic) => void", "(dynamic, dynamic) => void"},
4771 {"_List@915557746", "_List"},
4772 {"_HashMap@600006304<K, V>(dynamic) => V", "_HashMap<K, V>(dynamic) => V"},
4773 {"set:foo", "foo="},
4774 {"get:foo", "foo"},
4775 {"_ReceivePortImpl@709387912", "_ReceivePortImpl"},
4776 {"_ReceivePortImpl@709387912._internal@709387912",
4777 "_ReceivePortImpl._internal"},
4778 {"_C@6328321&_E@6328321&_F@6328321", "_C&_E&_F"},
4779 {"List.", "List"},
4780 {"get:foo@6328321", "foo"},
4781 {"_MyClass@6328321.", "_MyClass"},
4782 {"_MyClass@6328321.named", "_MyClass.named"},
4783 };
4784 String& test = String::Handle();
4785 String& result = String::Handle();
4786 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
4787 test = String::New(tests[i].in);
4788 result = String::IdentifierPrettyName(test);
4789 EXPECT_STREQ(tests[i].out, result.ToCString());
4790 }
4791 }
4792
4761 } // namespace dart 4793 } // namespace dart
OLDNEW
« 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