1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4 * Any copyright is dedicated to the Public Domain.
5 * http://creativecommons.org/licenses/publicdomain/
8 function callFunctionBody(expr
) {
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'
19 assertEq(testLenientAndStrict(callFunctionBody('arguments[0] = 42'),
20 returns(42), returns(42)),
23 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[0]'),
24 returns(true), returns(true)),
28 assertEq(testLenientAndStrict(callFunctionBody('arguments[1] = 42'),
29 returns(42), raisesException(TypeError
)),
32 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[1]'),
33 returns(true), returns(true)),
37 assertEq(testLenientAndStrict(callFunctionBody('arguments[2] = 42'),
38 returns(42), returns(42)),
41 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[2]'),
42 returns(false), raisesException(TypeError
)),
46 assertEq(testLenientAndStrict(callFunctionBody('arguments[3] = 42'),
47 returns(42), raisesException(TypeError
)),
50 assertEq(testLenientAndStrict(callFunctionBody('delete arguments[3]'),
51 returns(false), raisesException(TypeError
)),
55 reportCompare(true, true);
57 var successfullyParsed
= true;