From eea2f45421ba3558bb45888e1846447c95cd1264 Mon Sep 17 00:00:00 2001 From: Mark Miller Date: Sun, 25 Sep 2011 10:40:20 -0700 Subject: [PATCH] Tests for spec violation generically by enumerating properties. --- .../11.4.1_The_delete_Operator/S11.4.1_A5.js | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js b/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js index 0685fcc871..b7faa6fdf8 100644 --- a/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js +++ b/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js @@ -11,12 +11,22 @@ * @onlyStrict */ "use strict"; -var deleted = 'unassigned'; -try { - deleted = delete RegExp.leftContext; -} catch (err) { -} -if (deleted === false) { - $ERROR('Strict delete returned false'); +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'); + } + } }