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

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

Issue 7740046: Changed the order of arguments in the check as suggested to issue 1341. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 14434 matching lines...) Expand 10 before | Expand all | Expand 10 after
14445 } 14445 }
14446 14446
14447 14447
14448 TEST(RegExp) { 14448 TEST(RegExp) {
14449 v8::HandleScope scope; 14449 v8::HandleScope scope;
14450 LocalContext context; 14450 LocalContext context;
14451 14451
14452 v8::Handle<v8::RegExp> re = v8::RegExp::New(v8_str("foo"), v8::RegExp::kNone); 14452 v8::Handle<v8::RegExp> re = v8::RegExp::New(v8_str("foo"), v8::RegExp::kNone);
14453 CHECK(re->IsRegExp()); 14453 CHECK(re->IsRegExp());
14454 CHECK(re->GetSource()->Equals(v8_str("foo"))); 14454 CHECK(re->GetSource()->Equals(v8_str("foo")));
14455 CHECK_EQ(re->GetFlags(), v8::RegExp::kNone); 14455 CHECK_EQ(v8::RegExp::kNone, re->GetFlags());
14456 14456
14457 re = v8::RegExp::New(v8_str("bar"), 14457 re = v8::RegExp::New(v8_str("bar"),
14458 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | 14458 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase |
14459 v8::RegExp::kGlobal)); 14459 v8::RegExp::kGlobal));
14460 CHECK(re->IsRegExp()); 14460 CHECK(re->IsRegExp());
14461 CHECK(re->GetSource()->Equals(v8_str("bar"))); 14461 CHECK(re->GetSource()->Equals(v8_str("bar")));
14462 CHECK_EQ(static_cast<int>(re->GetFlags()), 14462 CHECK_EQ(v8::RegExp::kIgnoreCase | v8::RegExp::kGlobal,
14463 v8::RegExp::kIgnoreCase | v8::RegExp::kGlobal); 14463 static_cast<int>(re->GetFlags()));
14464 14464
14465 re = v8::RegExp::New(v8_str("baz"), 14465 re = v8::RegExp::New(v8_str("baz"),
14466 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | 14466 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase |
14467 v8::RegExp::kMultiline)); 14467 v8::RegExp::kMultiline));
14468 CHECK(re->IsRegExp()); 14468 CHECK(re->IsRegExp());
14469 CHECK(re->GetSource()->Equals(v8_str("baz"))); 14469 CHECK(re->GetSource()->Equals(v8_str("baz")));
14470 CHECK_EQ(static_cast<int>(re->GetFlags()), 14470 CHECK_EQ(v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline,
14471 v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline); 14471 static_cast<int>(re->GetFlags()));
14472 14472
14473 re = CompileRun("/quux/").As<v8::RegExp>(); 14473 re = CompileRun("/quux/").As<v8::RegExp>();
14474 CHECK(re->IsRegExp()); 14474 CHECK(re->IsRegExp());
14475 CHECK(re->GetSource()->Equals(v8_str("quux"))); 14475 CHECK(re->GetSource()->Equals(v8_str("quux")));
14476 CHECK_EQ(re->GetFlags(), v8::RegExp::kNone); 14476 CHECK_EQ(v8::RegExp::kNone, re->GetFlags());
14477 14477
14478 re = CompileRun("/quux/gm").As<v8::RegExp>(); 14478 re = CompileRun("/quux/gm").As<v8::RegExp>();
14479 CHECK(re->IsRegExp()); 14479 CHECK(re->IsRegExp());
14480 CHECK(re->GetSource()->Equals(v8_str("quux"))); 14480 CHECK(re->GetSource()->Equals(v8_str("quux")));
14481 CHECK_EQ(static_cast<int>(re->GetFlags()), 14481 CHECK_EQ(v8::RegExp::kGlobal | v8::RegExp::kMultiline,
14482 v8::RegExp::kGlobal | v8::RegExp::kMultiline); 14482 static_cast<int>(re->GetFlags()));
14483 14483
14484 // Override the RegExp constructor and check the API constructor 14484 // Override the RegExp constructor and check the API constructor
14485 // still works. 14485 // still works.
14486 CompileRun("RegExp = function() {}"); 14486 CompileRun("RegExp = function() {}");
14487 14487
14488 re = v8::RegExp::New(v8_str("foobar"), v8::RegExp::kNone); 14488 re = v8::RegExp::New(v8_str("foobar"), v8::RegExp::kNone);
14489 CHECK(re->IsRegExp()); 14489 CHECK(re->IsRegExp());
14490 CHECK(re->GetSource()->Equals(v8_str("foobar"))); 14490 CHECK(re->GetSource()->Equals(v8_str("foobar")));
14491 CHECK_EQ(re->GetFlags(), v8::RegExp::kNone); 14491 CHECK_EQ(v8::RegExp::kNone, re->GetFlags());
14492 14492
14493 re = v8::RegExp::New(v8_str("foobarbaz"), 14493 re = v8::RegExp::New(v8_str("foobarbaz"),
14494 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | 14494 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase |
14495 v8::RegExp::kMultiline)); 14495 v8::RegExp::kMultiline));
14496 CHECK(re->IsRegExp()); 14496 CHECK(re->IsRegExp());
14497 CHECK(re->GetSource()->Equals(v8_str("foobarbaz"))); 14497 CHECK(re->GetSource()->Equals(v8_str("foobarbaz")));
14498 CHECK_EQ(static_cast<int>(re->GetFlags()), 14498 CHECK_EQ(v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline,
14499 v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline); 14499 static_cast<int>(re->GetFlags()));
14500 14500
14501 context->Global()->Set(v8_str("re"), re); 14501 context->Global()->Set(v8_str("re"), re);
14502 ExpectTrue("re.test('FoobarbaZ')"); 14502 ExpectTrue("re.test('FoobarbaZ')");
14503 14503
14504 // RegExps are objects on which you can set properties. 14504 // RegExps are objects on which you can set properties.
14505 re->Set(v8_str("property"), v8::Integer::New(32)); 14505 re->Set(v8_str("property"), v8::Integer::New(32));
14506 v8::Handle<v8::Value> value = CompileRun("re.property"); 14506 v8::Handle<v8::Value> value = CompileRun("re.property");
14507 ASSERT_EQ(32, value->Int32Value()); 14507 ASSERT_EQ(32, value->Int32Value());
14508 14508
14509 v8::TryCatch try_catch; 14509 v8::TryCatch try_catch;
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
15039 15039
15040 Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)"); 15040 Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)");
15041 CHECK(result5->Equals( 15041 CHECK(result5->Equals(
15042 object_with_hidden->GetPrototype()->ToObject()->GetPrototype())); 15042 object_with_hidden->GetPrototype()->ToObject()->GetPrototype()));
15043 15043
15044 Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)"); 15044 Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)");
15045 CHECK(result6->Equals(Undefined())); 15045 CHECK(result6->Equals(Undefined()));
15046 15046
15047 context.Dispose(); 15047 context.Dispose();
15048 } 15048 }
OLDNEW
« 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