js/src/tests/ecma_5/strict/10.6.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /*
     4  * Any copyright is dedicated to the Public Domain.
     5  * http://creativecommons.org/licenses/publicdomain/
     6  */
     8 function callFunctionBody(expr) {
     9   return (
    10     '(function f() {\n'
    11     + 'Object.defineProperties(arguments, {1: { writable: false },\n'
    12     + '                                    2: { configurable: false },\n'
    13     + '                                    3: { writable: false,\n'
    14     + '                                        configurable: false }});\n'
    15     + 'return (' + expr + ');\n'
    16     + '})(0, 1, 2, 3);');
    17 }
    19 assertEq(testLenientAndStrict(callFunctionBody('arguments[0] = 42'),
    20                               returns(42), returns(42)),
    21          true);
    23 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[0]'),
    24                               returns(true), returns(true)),
    25          true);
    28 assertEq(testLenientAndStrict(callFunctionBody('arguments[1] = 42'),
    29                               returns(42), raisesException(TypeError)),
    30          true);
    32 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[1]'),
    33                               returns(true), returns(true)),
    34          true);
    37 assertEq(testLenientAndStrict(callFunctionBody('arguments[2] = 42'),
    38                               returns(42), returns(42)),
    39          true);
    41 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[2]'),
    42                               returns(false), raisesException(TypeError)),
    43          true);
    46 assertEq(testLenientAndStrict(callFunctionBody('arguments[3] = 42'),
    47                               returns(42), raisesException(TypeError)),
    48          true);
    50 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[3]'),
    51                               returns(false), raisesException(TypeError)),
    52          true);
    55 reportCompare(true, true);

mercurial