js/src/tests/test262/ch11/11.4/11.4.1/S11.4.1_A5.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 // Copyright 2011 Google Inc. All rights reserved.
michael@0 2 // This code is governed by the BSD license found in the LICENSE file.
michael@0 3
michael@0 4 /**
michael@0 5 * A strict delete should either succeed, returning true, or it
michael@0 6 * should fail by throwing a TypeError. Under no circumstances
michael@0 7 * should a strict delete return false.
michael@0 8 *
michael@0 9 * @path ch11/11.4/11.4.1/S11.4.1_A5.js
michael@0 10 * @description See if a strict delete returns false when deleting a
michael@0 11 * non-standard property.
michael@0 12 * @onlyStrict
michael@0 13 */
michael@0 14
michael@0 15 "use strict";
michael@0 16
michael@0 17 var reNames = Object.getOwnPropertyNames(RegExp);
michael@0 18 for (var i = 0, len = reNames.length; i < len; i++) {
michael@0 19 var reName = reNames[i];
michael@0 20 if (reName !== 'prototype') {
michael@0 21 var deleted = 'unassigned';
michael@0 22 try {
michael@0 23 deleted = delete RegExp[reName];
michael@0 24 } catch (err) {
michael@0 25 if (!(err instanceof TypeError)) {
michael@0 26 $ERROR('#1: strict delete threw a non-TypeError: ' + err);
michael@0 27 }
michael@0 28 // fall through
michael@0 29 }
michael@0 30 if (deleted === false) {
michael@0 31 $ERROR('#2: Strict delete returned false');
michael@0 32 }
michael@0 33 }
michael@0 34 }
michael@0 35

mercurial