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

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

Issue 108083005: ES6: Add Object.getOwnPropertySymbols (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment and formatting based on code review Created 6 years, 11 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/v8natives.js ('k') | test/mjsunit/harmony/symbols.js » ('j') | 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 10056 matching lines...) Expand 10 before | Expand all | Expand 10 after
10067 Local<v8::Object> o4 = t4->GetFunction()->NewInstance(); 10067 Local<v8::Object> o4 = t4->GetFunction()->NewInstance();
10068 10068
10069 // Create prototype chain of hidden prototypes. 10069 // Create prototype chain of hidden prototypes.
10070 CHECK(o4->SetPrototype(o3)); 10070 CHECK(o4->SetPrototype(o3));
10071 CHECK(o3->SetPrototype(o2)); 10071 CHECK(o3->SetPrototype(o2));
10072 CHECK(o2->SetPrototype(o1)); 10072 CHECK(o2->SetPrototype(o1));
10073 10073
10074 // Call the runtime version of GetLocalPropertyNames() on the natively 10074 // Call the runtime version of GetLocalPropertyNames() on the natively
10075 // created object through JavaScript. 10075 // created object through JavaScript.
10076 context->Global()->Set(v8_str("obj"), o4); 10076 context->Global()->Set(v8_str("obj"), o4);
10077 CompileRun("var names = %GetLocalPropertyNames(obj, true);"); 10077 // PROPERTY_ATTRIBUTES_NONE = 0
10078 CompileRun("var names = %GetLocalPropertyNames(obj, 0);");
10078 10079
10079 ExpectInt32("names.length", 1006); 10080 ExpectInt32("names.length", 1006);
10080 ExpectTrue("names.indexOf(\"baz\") >= 0"); 10081 ExpectTrue("names.indexOf(\"baz\") >= 0");
10081 ExpectTrue("names.indexOf(\"boo\") >= 0"); 10082 ExpectTrue("names.indexOf(\"boo\") >= 0");
10082 ExpectTrue("names.indexOf(\"foo\") >= 0"); 10083 ExpectTrue("names.indexOf(\"foo\") >= 0");
10083 ExpectTrue("names.indexOf(\"fuz1\") >= 0"); 10084 ExpectTrue("names.indexOf(\"fuz1\") >= 0");
10084 ExpectTrue("names.indexOf(\"fuz2\") >= 0"); 10085 ExpectTrue("names.indexOf(\"fuz2\") >= 0");
10085 ExpectFalse("names[1005] == undefined"); 10086 ExpectFalse("names[1005] == undefined");
10086 } 10087 }
10087 10088
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
10121 10122
10122 v8::Local<v8::Symbol> sym = v8::Symbol::New(context->GetIsolate(), "s1"); 10123 v8::Local<v8::Symbol> sym = v8::Symbol::New(context->GetIsolate(), "s1");
10123 o1->Set(sym, v8_num(3)); 10124 o1->Set(sym, v8_num(3));
10124 o1->SetHiddenValue(v8_str("h1"), 10125 o1->SetHiddenValue(v8_str("h1"),
10125 v8::Integer::New(context->GetIsolate(), 2013)); 10126 v8::Integer::New(context->GetIsolate(), 2013));
10126 10127
10127 // Call the runtime version of GetLocalPropertyNames() on 10128 // Call the runtime version of GetLocalPropertyNames() on
10128 // the natively created object through JavaScript. 10129 // the natively created object through JavaScript.
10129 context->Global()->Set(v8_str("obj"), o2); 10130 context->Global()->Set(v8_str("obj"), o2);
10130 context->Global()->Set(v8_str("sym"), sym); 10131 context->Global()->Set(v8_str("sym"), sym);
10131 CompileRun("var names = %GetLocalPropertyNames(obj, true);"); 10132 // PROPERTY_ATTRIBUTES_NONE = 0
10133 CompileRun("var names = %GetLocalPropertyNames(obj, 0);");
10132 10134
10133 ExpectInt32("names.length", 7); 10135 ExpectInt32("names.length", 7);
10134 ExpectTrue("names.indexOf(\"foo\") >= 0"); 10136 ExpectTrue("names.indexOf(\"foo\") >= 0");
10135 ExpectTrue("names.indexOf(\"bar\") >= 0"); 10137 ExpectTrue("names.indexOf(\"bar\") >= 0");
10136 ExpectTrue("names.indexOf(\"baz\") >= 0"); 10138 ExpectTrue("names.indexOf(\"baz\") >= 0");
10137 ExpectTrue("names.indexOf(\"n1\") >= 0"); 10139 ExpectTrue("names.indexOf(\"n1\") >= 0");
10138 ExpectTrue("names.indexOf(\"n2\") >= 0"); 10140 ExpectTrue("names.indexOf(\"n2\") >= 0");
10139 ExpectTrue("names.indexOf(sym) >= 0"); 10141 ExpectTrue("names.indexOf(sym) >= 0");
10140 ExpectTrue("names.indexOf(\"mine\") >= 0"); 10142 ExpectTrue("names.indexOf(\"mine\") >= 0");
10141 } 10143 }
(...skipping 10903 matching lines...) Expand 10 before | Expand all | Expand 10 after
21045 CheckCorrectThrow("%GetProperty(other, 'x')"); 21047 CheckCorrectThrow("%GetProperty(other, 'x')");
21046 CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 1, 0)"); 21048 CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 1, 0)");
21047 CheckCorrectThrow("%IgnoreAttributesAndSetProperty(other, 'x', 'foo')"); 21049 CheckCorrectThrow("%IgnoreAttributesAndSetProperty(other, 'x', 'foo')");
21048 CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); 21050 CheckCorrectThrow("%DeleteProperty(other, 'x', 0)");
21049 CheckCorrectThrow("%DeleteProperty(other, '1', 0)"); 21051 CheckCorrectThrow("%DeleteProperty(other, '1', 0)");
21050 CheckCorrectThrow("%HasLocalProperty(other, 'x')"); 21052 CheckCorrectThrow("%HasLocalProperty(other, 'x')");
21051 CheckCorrectThrow("%HasProperty(other, 'x')"); 21053 CheckCorrectThrow("%HasProperty(other, 'x')");
21052 CheckCorrectThrow("%HasElement(other, 1)"); 21054 CheckCorrectThrow("%HasElement(other, 1)");
21053 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); 21055 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')");
21054 CheckCorrectThrow("%GetPropertyNames(other)"); 21056 CheckCorrectThrow("%GetPropertyNames(other)");
21055 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); 21057 // PROPERTY_ATTRIBUTES_NONE = 0
21058 CheckCorrectThrow("%GetLocalPropertyNames(other, 0)");
21056 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" 21059 CheckCorrectThrow("%DefineOrRedefineAccessorProperty("
21057 "other, 'x', null, null, 1)"); 21060 "other, 'x', null, null, 1)");
21058 21061
21059 // Reset the failed access check callback so it does not influence 21062 // Reset the failed access check callback so it does not influence
21060 // the other tests. 21063 // the other tests.
21061 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); 21064 v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
21062 } 21065 }
21063 21066
21064 21067
21065 THREADED_TEST(Regress256330) { 21068 THREADED_TEST(Regress256330) {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
21472 } 21475 }
21473 for (int i = 0; i < runs; i++) { 21476 for (int i = 0; i < runs; i++) {
21474 Local<String> expected; 21477 Local<String> expected;
21475 if (i != 0) { 21478 if (i != 0) {
21476 CHECK_EQ(v8_str("escape value"), values[i]); 21479 CHECK_EQ(v8_str("escape value"), values[i]);
21477 } else { 21480 } else {
21478 CHECK(values[i].IsEmpty()); 21481 CHECK(values[i].IsEmpty());
21479 } 21482 }
21480 } 21483 }
21481 } 21484 }
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/harmony/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698