js/src/tests/ecma_3/ExecutionContexts/10.1.4-1.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_3/ExecutionContexts/10.1.4-1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   ECMA Section: 10.1.4.1 Entering An Execution Context
    1.12 +   ECMA says:
    1.13 +   * Global Code, Function Code
    1.14 +   Variable instantiation is performed using the global object as the
    1.15 +   variable object and using property attributes { DontDelete }.
    1.16 +
    1.17 +   * Eval Code
    1.18 +   Variable instantiation is performed using the calling context's
    1.19 +   variable object and using empty property attributes.
    1.20 +*/
    1.21 +
    1.22 +var BUGNUMBER = '(none)';
    1.23 +var summary = '10.1.4.1 Entering An Execution Context';
    1.24 +var actual = '';
    1.25 +var expect = '';
    1.26 +
    1.27 +test();
    1.28 +
    1.29 +function test()
    1.30 +{
    1.31 +  enterFunc ("test");
    1.32 +  printBugNumber(BUGNUMBER);
    1.33 +  printStatus (summary);
    1.34 +
    1.35 +  var y;
    1.36 +  eval("var x = 1");
    1.37 +
    1.38 +  if (delete y)
    1.39 +    reportCompare('PASS', 'FAIL', "Expected *NOT* to be able to delete y");
    1.40 +
    1.41 +  if (typeof x == "undefined")
    1.42 +    reportCompare('PASS', 'FAIL', "x did not remain defined after eval()");
    1.43 +  else if (x != 1)
    1.44 +    reportCompare('PASS', 'FAIL', "x did not retain it's value after eval()");
    1.45 +   
    1.46 +  if (!delete x)
    1.47 +    reportCompare('PASS', 'FAIL', "Expected to be able to delete x");
    1.48 +
    1.49 +  reportCompare('PASS', 'PASS', '10.1.4.1 Entering An Execution Context');
    1.50 +
    1.51 +  exitFunc("test");       
    1.52 +}

mercurial