| Index: test/mjsunit/global.js
|
| diff --git a/test/mjsunit/compiler/control-flow-1.js b/test/mjsunit/global.js
|
| similarity index 54%
|
| copy from test/mjsunit/compiler/control-flow-1.js
|
| copy to test/mjsunit/global.js
|
| index ca7ad8785017200dc3b37b26f0bd95b896846185..05e8453bab2543ca3a383fa2c5e50fce9598d3c0 100644
|
| --- a/test/mjsunit/compiler/control-flow-1.js
|
| +++ b/test/mjsunit/global.js
|
| @@ -24,32 +24,45 @@
|
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| -
|
| +//
|
| var global = this;
|
|
|
| -function f0(x) {
|
| - assertTrue(this === global);
|
| - return x;
|
| -}
|
| -
|
| -function g0(x, y) {
|
| - return f0(x == y);
|
| +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));
|
| }
|
|
|
| -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');
|
|
|