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'); |