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

Side by Side Diff: runtime/vm/stack_frame_test.cc

Issue 1331623002: Uses SNPRINT macro where possible. Otherwise uses #define for format. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add missing include 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/snapshot.cc ('k') | runtime/vm/timeline.cc » ('j') | 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 Function::Handle(frame->LookupDartFunction()); 94 Function::Handle(frame->LookupDartFunction());
95 if (function.IsNull()) { 95 if (function.IsNull()) {
96 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n"); 96 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n");
97 } 97 }
98 const char* name = function.ToFullyQualifiedCString(); 98 const char* name = function.ToFullyQualifiedCString();
99 // Currently all unit tests are loaded as being part of dart:core-lib. 99 // Currently all unit tests are loaded as being part of dart:core-lib.
100 String& url = String::Handle(String::New(TestCase::url())); 100 String& url = String::Handle(String::New(TestCase::url()));
101 const Library& lib = Library::Handle(Library::LookupLibrary(url)); 101 const Library& lib = Library::Handle(Library::LookupLibrary(url));
102 ASSERT(!lib.IsNull()); 102 ASSERT(!lib.IsNull());
103 const char* lib_name = String::Handle(lib.url()).ToCString(); 103 const char* lib_name = String::Handle(lib.url()).ToCString();
104 intptr_t length = OS::SNPrint(NULL, 0, "%s_%s", lib_name, expected_name); 104 char* full_name = OS::SCreate(Thread::Current()->zone(),
105 char* full_name = Thread::Current()->zone()->Alloc<char>(length + 1); 105 "%s_%s", lib_name, expected_name);
106 ASSERT(full_name != NULL);
107 OS::SNPrint(full_name, (length + 1), "%s_%s", lib_name, expected_name);
108 if (strcmp(full_name, name) != 0) { 106 if (strcmp(full_name, name) != 0) {
109 FATAL("StackFrame_validateFrame fails, incorrect frame.\n"); 107 FATAL("StackFrame_validateFrame fails, incorrect frame.\n");
110 } 108 }
111 return; 109 return;
112 } 110 }
113 count += 1; // Count the dart frames. 111 count += 1; // Count the dart frames.
114 frame = frames.NextFrame(); 112 frame = frames.NextFrame();
115 } 113 }
116 FATAL("StackFrame_validateFrame fails, frame count < index passed in.\n"); 114 FATAL("StackFrame_validateFrame fails, frame count < index passed in.\n");
117 } 115 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 "}"; 318 "}";
321 } 319 }
322 Dart_Handle lib = TestCase::LoadTestScript( 320 Dart_Handle lib = TestCase::LoadTestScript(
323 kScriptChars, 321 kScriptChars,
324 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 322 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
325 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test")); 323 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test"));
326 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL)); 324 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL));
327 } 325 }
328 326
329 } // namespace dart 327 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698