Mike Pennisi 29ecced632 Update handling of directive prologues
Some tests specifically concern the application of the `use strict`
directive as it appears in JavaScript source code. These tests should
*not* be run with the `onlyStrict` flag because relying on the test
runner to enable strict mode makes the semantics of the source code
irrelevant. Update these tests to use the `noStrict` flag.

Other tests concern language semantics that are only valid in strict
mode, but the mechanism for enabling strictness is inconseqential.
Update these tests to use the `onlyStrict` flag and remove any redundant
`use strict` directive prologues contained within.

Still other tests are valid both within and outside of strict mode.
In keeping with the majority of other tests, do not specify any
restrictions on the environments in which these tests may be run.
2015-06-18 17:38:34 -04:00

34 lines
951 B
JavaScript

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