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

Side by Side Diff: test/cctest/test-api.cc

Issue 6674034: Fix Array::New(length) in the API to return an array with the provided length. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/factory.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 CHECK(!array->Has(0)); 2071 CHECK(!array->Has(0));
2072 CHECK(!array->Has(1)); 2072 CHECK(!array->Has(1));
2073 CHECK(array->Has(2)); 2073 CHECK(array->Has(2));
2074 CHECK_EQ(7, array->Get(2)->Int32Value()); 2074 CHECK_EQ(7, array->Get(2)->Int32Value());
2075 Local<Value> obj = Script::Compile(v8_str("[1, 2, 3]"))->Run(); 2075 Local<Value> obj = Script::Compile(v8_str("[1, 2, 3]"))->Run();
2076 Local<v8::Array> arr = obj.As<v8::Array>(); 2076 Local<v8::Array> arr = obj.As<v8::Array>();
2077 CHECK_EQ(3, arr->Length()); 2077 CHECK_EQ(3, arr->Length());
2078 CHECK_EQ(1, arr->Get(0)->Int32Value()); 2078 CHECK_EQ(1, arr->Get(0)->Int32Value());
2079 CHECK_EQ(2, arr->Get(1)->Int32Value()); 2079 CHECK_EQ(2, arr->Get(1)->Int32Value());
2080 CHECK_EQ(3, arr->Get(2)->Int32Value()); 2080 CHECK_EQ(3, arr->Get(2)->Int32Value());
2081 array = v8::Array::New(27);
2082 CHECK_EQ(27, array->Length());
2083 array = v8::Array::New(-27);
2084 CHECK_EQ(0, array->Length());
2081 } 2085 }
2082 2086
2083 2087
2084 v8::Handle<Value> HandleF(const v8::Arguments& args) { 2088 v8::Handle<Value> HandleF(const v8::Arguments& args) {
2085 v8::HandleScope scope; 2089 v8::HandleScope scope;
2086 ApiTestFuzzer::Fuzz(); 2090 ApiTestFuzzer::Fuzz();
2087 Local<v8::Array> result = v8::Array::New(args.Length()); 2091 Local<v8::Array> result = v8::Array::New(args.Length());
2088 for (int i = 0; i < args.Length(); i++) 2092 for (int i = 0; i < args.Length(); i++)
2089 result->Set(i, args[i]); 2093 result->Set(i, args[i]);
2090 return scope.Close(result); 2094 return scope.Close(result);
(...skipping 11015 matching lines...) Expand 10 before | Expand all | Expand 10 after
13106 v8::Handle<v8::Function> define_property = 13110 v8::Handle<v8::Function> define_property =
13107 CompileRun("(function() {" 13111 CompileRun("(function() {"
13108 " Object.defineProperty(" 13112 " Object.defineProperty("
13109 " this," 13113 " this,"
13110 " 1," 13114 " 1,"
13111 " { configurable: true, enumerable: true, value: 3 });" 13115 " { configurable: true, enumerable: true, value: 3 });"
13112 "})").As<Function>(); 13116 "})").As<Function>();
13113 context->DetachGlobal(); 13117 context->DetachGlobal();
13114 define_property->Call(proxy, 0, NULL); 13118 define_property->Call(proxy, 0, NULL);
13115 } 13119 }
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698