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

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

Issue 6349044: Revert revision 6555 as it causes win32 debug to fail. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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/api.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 12195 matching lines...) Expand 10 before | Expand all | Expand 10 after
12206 12206
12207 v8::TryCatch try_catch; 12207 v8::TryCatch try_catch;
12208 re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone); 12208 re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone);
12209 CHECK(re.IsEmpty()); 12209 CHECK(re.IsEmpty());
12210 CHECK(try_catch.HasCaught()); 12210 CHECK(try_catch.HasCaught());
12211 context->Global()->Set(v8_str("ex"), try_catch.Exception()); 12211 context->Global()->Set(v8_str("ex"), try_catch.Exception());
12212 ExpectTrue("ex instanceof SyntaxError"); 12212 ExpectTrue("ex instanceof SyntaxError");
12213 } 12213 }
12214 12214
12215 12215
12216 THREADED_TEST(Equals) {
12217 v8::HandleScope handleScope;
12218 LocalContext localContext;
12219
12220 v8::Handle<v8::Object> globalProxy = localContext->Global();
12221 v8::Handle<Value> global = globalProxy->GetPrototype();
12222
12223 CHECK(global->StrictEquals(global));
12224 CHECK(!global->StrictEquals(globalProxy));
12225 CHECK(!globalProxy->StrictEquals(global));
12226 CHECK(globalProxy->StrictEquals(globalProxy));
12227
12228 CHECK(global->Equals(global));
12229 CHECK(!global->Equals(globalProxy));
12230 CHECK(!globalProxy->Equals(global));
12231 CHECK(globalProxy->Equals(globalProxy));
12232 }
12233
12234
12235 static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, 12216 static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property,
12236 const v8::AccessorInfo& info ) { 12217 const v8::AccessorInfo& info ) {
12237 return v8_str("42!"); 12218 return v8_str("42!");
12238 } 12219 }
12239 12220
12240 12221
12241 static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) { 12222 static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) {
12242 v8::Handle<v8::Array> result = v8::Array::New(); 12223 v8::Handle<v8::Array> result = v8::Array::New();
12243 result->Set(0, v8_str("universalAnswer")); 12224 result->Set(0, v8_str("universalAnswer"));
12244 return result; 12225 return result;
12245 } 12226 }
12246 12227
12247 12228
12248 TEST(NamedEnumeratorAndForIn) { 12229 TEST(NamedEnumeratorAndForIn) {
12249 v8::HandleScope handle_scope; 12230 v8::HandleScope handle_scope;
12250 LocalContext context; 12231 LocalContext context;
12251 v8::Context::Scope context_scope(context.local()); 12232 v8::Context::Scope context_scope(context.local());
12252 12233
12253 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); 12234 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New();
12254 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); 12235 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator);
12255 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); 12236 context->Global()->Set(v8_str("o"), tmpl->NewInstance());
12256 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( 12237 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
12257 "var result = []; for (var k in o) result.push(k); result")); 12238 "var result = []; for (var k in o) result.push(k); result"));
12258 CHECK_EQ(1, result->Length()); 12239 CHECK_EQ(1, result->Length());
12259 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); 12240 CHECK_EQ(v8_str("universalAnswer"), result->Get(0));
12260 } 12241 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698