Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/preventExtensions/15.2.3.10-3-5.js

raw
1 // Copyright (c) 2012 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es5id: 15.2.3.10-3-5
6 description: >
7 Object.preventExtensions - indexed properties cannot be added into
8 a String object
9 ---*/
10
11 var strObj = new String();
12 var preCheck = Object.isExtensible(strObj);
13 Object.preventExtensions(strObj);
14 assert.throws(TypeError, function() {
15 Object.defineProperty(strObj, "0", {
16 value: "c"
17 });
18 });
19 assert(preCheck, 'preCheck !== true');
20 assert.sameValue(strObj.hasOwnProperty("0"), false, 'strObj.hasOwnProperty("0")');
21 assert.sameValue(typeof strObj[0], "undefined", 'typeof strObj[0]');