michael@0: // Copyright 2011 Google Inc. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * A strict delete should either succeed, returning true, or it michael@0: * should fail by throwing a TypeError. Under no circumstances michael@0: * should a strict delete return false. michael@0: * michael@0: * @path ch11/11.4/11.4.1/S11.4.1_A5.js michael@0: * @description See if a strict delete returns false when deleting a michael@0: * non-standard property. michael@0: * @onlyStrict michael@0: */ michael@0: michael@0: "use strict"; michael@0: michael@0: var reNames = Object.getOwnPropertyNames(RegExp); michael@0: for (var i = 0, len = reNames.length; i < len; i++) { michael@0: var reName = reNames[i]; michael@0: if (reName !== 'prototype') { michael@0: var deleted = 'unassigned'; michael@0: try { michael@0: deleted = delete RegExp[reName]; michael@0: } catch (err) { michael@0: if (!(err instanceof TypeError)) { michael@0: $ERROR('#1: strict delete threw a non-TypeError: ' + err); michael@0: } michael@0: // fall through michael@0: } michael@0: if (deleted === false) { michael@0: $ERROR('#2: Strict delete returned false'); michael@0: } michael@0: } michael@0: } michael@0: