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

Unified Diff: test/mjsunit/global-properties.js

Issue 1378323003: [runtime-object]: part fix element key list on global object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing nits Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-global-object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/global-properties.js
diff --git a/test/mjsunit/compiler/control-flow-1.js b/test/mjsunit/global-properties.js
similarity index 54%
copy from test/mjsunit/compiler/control-flow-1.js
copy to test/mjsunit/global-properties.js
index ca7ad8785017200dc3b37b26f0bd95b896846185..28e3e8f9cb0f267f5c96424703e7cc7e87b561d6 100644
--- a/test/mjsunit/compiler/control-flow-1.js
+++ b/test/mjsunit/global-properties.js
@@ -27,29 +27,42 @@
var global = this;
-function f0(x) {
- assertTrue(this === global);
- return x;
+function testNamedProperty(key, value) {
+ global[key] = value;
+ assertTrue(global.hasOwnProperty(key));
+ assertTrue(-1 < Object.keys(global).indexOf(key));
+ assertTrue(-1 < Object.getOwnPropertyNames(global).indexOf(key));
+ assertTrue(-1 == Object.getOwnPropertySymbols(global).indexOf(key));
}
-function g0(x, y) {
- return f0(x == y);
-}
-
-assertTrue(g0(0, 0));
-assertFalse(g0(0, 1));
+testNamedProperty('property0', 'value');
+testNamedProperty('0property', 'value');
+testNamedProperty('42', 'value');
-
-var o = {};
-o.f1 = f1;
-function f1(x) {
- assertTrue(this === o);
- return x;
+function testNamedNonEnumerableProperty(key, value) {
+ Object.defineProperty(global, key, {
+ enumerable: false,
+ value: value
+ });
+ assertTrue(global.hasOwnProperty(key));
+ assertTrue(-1 == Object.keys(global).indexOf(key));
+ assertTrue(-1 < Object.getOwnPropertyNames(global).indexOf(key));
+ assertTrue(-1 == Object.getOwnPropertySymbols(global).indexOf(key));
}
-function g1(x, y) {
- return o.f1(x == y);
+testNamedNonEnumerableProperty('property1', 'value');
+testNamedNonEnumerableProperty('1property', 'value');
+testNamedNonEnumerableProperty('43', 'value');
+
+function testSymbolProperty(key, value) {
+ key = Symbol(key);
+ global[key] = value;
+ assertTrue(global.hasOwnProperty(key));
+ assertTrue(-1 == Object.keys(global).indexOf(key));
+ assertTrue(-1 == Object.getOwnPropertyNames(global).indexOf(key));
+ assertTrue(-1 < Object.getOwnPropertySymbols(global).indexOf(key));
}
-assertTrue(g1(0, 0));
-assertFalse(g1(0, 1));
+testSymbolProperty('property2', 'value');
+testSymbolProperty('2property', 'value');
+testSymbolProperty('43', 'value');
« no previous file with comments | « test/cctest/test-global-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698