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

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

Issue 460333002: Expose Value::IsArgumentsObject in V8 API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
« src/api.cc ('K') | « 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 v8::Handle<Value> syntax_error = CompileRun( 1532 v8::Handle<Value> syntax_error = CompileRun(
1533 "var out = 0; try { eval(\"#\"); } catch(x) { out = x; } out; "); 1533 "var out = 0; try { eval(\"#\"); } catch(x) { out = x; } out; ");
1534 CHECK(syntax_error->IsNativeError()); 1534 CHECK(syntax_error->IsNativeError());
1535 v8::Handle<Value> not_error = CompileRun("{a:42}"); 1535 v8::Handle<Value> not_error = CompileRun("{a:42}");
1536 CHECK(!not_error->IsNativeError()); 1536 CHECK(!not_error->IsNativeError());
1537 v8::Handle<Value> not_object = CompileRun("42"); 1537 v8::Handle<Value> not_object = CompileRun("42");
1538 CHECK(!not_object->IsNativeError()); 1538 CHECK(!not_object->IsNativeError());
1539 } 1539 }
1540 1540
1541 1541
1542 THREADED_TEST(ArgumentsObject) {
1543 LocalContext env;
1544 v8::HandleScope scope(env->GetIsolate());
1545 v8::Handle<Value> arguments_object =
1546 CompileRun("var out = 0; (function(){ out = arguments; })(1,2,3); out;");
1547 CHECK(arguments_object->IsArgumentsObject());
1548 v8::Handle<Value> array = CompileRun("[1,2,3]");
1549 CHECK(!array->IsArgumentsObject());
1550 v8::Handle<Value> object = CompileRun("{a:42}");
1551 CHECK(!object->IsArgumentsObject());
1552 }
1553
1554
1542 THREADED_TEST(StringObject) { 1555 THREADED_TEST(StringObject) {
1543 LocalContext env; 1556 LocalContext env;
1544 v8::HandleScope scope(env->GetIsolate()); 1557 v8::HandleScope scope(env->GetIsolate());
1545 v8::Handle<Value> boxed_string = CompileRun("new String(\"test\")"); 1558 v8::Handle<Value> boxed_string = CompileRun("new String(\"test\")");
1546 CHECK(boxed_string->IsStringObject()); 1559 CHECK(boxed_string->IsStringObject());
1547 v8::Handle<Value> unboxed_string = CompileRun("\"test\""); 1560 v8::Handle<Value> unboxed_string = CompileRun("\"test\"");
1548 CHECK(!unboxed_string->IsStringObject()); 1561 CHECK(!unboxed_string->IsStringObject());
1549 v8::Handle<Value> boxed_not_string = CompileRun("new Number(42)"); 1562 v8::Handle<Value> boxed_not_string = CompileRun("new Number(42)");
1550 CHECK(!boxed_not_string->IsStringObject()); 1563 CHECK(!boxed_not_string->IsStringObject());
1551 v8::Handle<Value> not_object = CompileRun("0"); 1564 v8::Handle<Value> not_object = CompileRun("0");
(...skipping 21309 matching lines...) Expand 10 before | Expand all | Expand 10 after
22861 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); 22874 desc = x->GetOwnPropertyDescriptor(v8_str("p1"));
22862 Local<Function> set = 22875 Local<Function> set =
22863 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); 22876 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set")));
22864 Local<Function> get = 22877 Local<Function> get =
22865 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); 22878 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get")));
22866 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); 22879 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL));
22867 Handle<Value> args[] = { v8_num(14) }; 22880 Handle<Value> args[] = { v8_num(14) };
22868 set->Call(x, 1, args); 22881 set->Call(x, 1, args);
22869 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); 22882 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL));
22870 } 22883 }
OLDNEW
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698