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

Unified Diff: test/cctest/test-parsing.cc

Issue 8339011: Use OS::SNPrintF instead of snprintf. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index f2effbb76c3235c44270bc7201fa4bc3b677f01d..05fafe32bee05d05e560c798bab7acdf742d356f 100755
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -746,7 +746,7 @@ TEST(RegExpScanning) {
}
-TEST(ScopePositiosn) {
+TEST(ScopePositions) {
// Test the parser for correctly setting the start and end positions
// of a scope. We check the scope positions of exactly one scope
// nested in the global scope of a program. 'inner source' is the
@@ -843,21 +843,23 @@ TEST(ScopePositiosn) {
size_t kInnerLen = strlen(source_data[i].inner_source);
size_t kSuffixLen = strlen(source_data[i].outer_suffix);
size_t kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
- i::SmartArrayPointer<char> program(
- reinterpret_cast<char*>(malloc(kProgramSize + 1)));
- snprintf(*program, kProgramSize + 1, "%s%s%s",
- source_data[i].outer_prefix,
- source_data[i].inner_source,
- source_data[i].outer_suffix);
+ i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
+ size_t length;
+ length = i::OS::SNPrintF(program, "%s%s%s",
+ source_data[i].outer_prefix,
+ source_data[i].inner_source,
+ source_data[i].outer_suffix);
+ ASSERT(length == kProgramSize);
// Parse program source.
i::Handle<i::String> source(
- FACTORY->NewStringFromAscii(i::CStrVector(*program)));
+ FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
i::Handle<i::Script> script = FACTORY->NewScript(source);
i::Parser parser(script, false, NULL, NULL);
parser.SetHarmonyScoping(true);
i::FunctionLiteral* function =
parser.ParseProgram(source, true, i::kNonStrictMode);
+ ASSERT(function != NULL);
// Check scope types and positions.
i::Scope* scope = function->scope();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698