summaryrefslogtreecommitdiff
path: root/test/built-ins/RegExp
diff options
context:
space:
mode:
authorAndré Bargull <andre.bargull@gmail.com>2015-05-14 17:22:12 +0200
committerAndré Bargull <andre.bargull@gmail.com>2015-05-18 18:01:00 +0200
commit56036e4064da981fec3b3bfc7f34e22e684b249b (patch)
treebaf22c328029ac5897d926febc7d85e69cf9d0b1 /test/built-ins/RegExp
parentb56af07567959c7962f9d639f5791fa5c25b4c08 (diff)
downloadqtdeclarative-testsuites-56036e4064da981fec3b3bfc7f34e22e684b249b.tar.gz
Enable strict mode for more built-in tests
- Remove no longer needed noStrict flags. - Change tests to use propertyHelper.js for strict mode compatibility. - Add tests for return value of `delete` operator, e.g. `delete Array.prototype === false`. - Add non-writable tests for global NaN property. - Split some tests to run in strict mode. - Change tests with global `var length` declaration to use a different variable name for browser environments. - Merge duplicated tests symbol-data-property-configurable-non-strict and symbol-data-property-configurable-strict. - Merge duplicated tests symbol-data-property-writable-non-strict and symbol-data-property-writable-strict. - (And a small change in propertyHelper to reduce code duplication in function call.)
Diffstat (limited to 'test/built-ins/RegExp')
-rw-r--r--test/built-ins/RegExp/prototype/S15.10.5.1_A3.js14
-rw-r--r--test/built-ins/RegExp/prototype/S15.10.5.1_A4.js7
-rw-r--r--test/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js7
-rw-r--r--test/built-ins/RegExp/prototype/global/S15.10.7.2_A10.js11
-rw-r--r--test/built-ins/RegExp/prototype/ignoreCase/S15.10.7.3_A10.js11
-rw-r--r--test/built-ins/RegExp/prototype/lastIndex/S15.10.7.5_A9.js16
-rw-r--r--test/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js11
-rw-r--r--test/built-ins/RegExp/prototype/source/S15.10.7.1_A10.js11
-rw-r--r--test/built-ins/RegExp/prototype/test/S15.10.6.3_A10.js7
-rw-r--r--test/built-ins/RegExp/prototype/toString/S15.10.6.4_A10.js7
10 files changed, 53 insertions, 49 deletions
diff --git a/test/built-ins/RegExp/prototype/S15.10.5.1_A3.js b/test/built-ins/RegExp/prototype/S15.10.5.1_A3.js
index 8a0d8eee7..55b48d98b 100644
--- a/test/built-ins/RegExp/prototype/S15.10.5.1_A3.js
+++ b/test/built-ins/RegExp/prototype/S15.10.5.1_A3.js
@@ -5,8 +5,7 @@
info: The RegExp.prototype property has the attribute DontDelete
es5id: 15.10.5.1_A3
description: Checking if deleting the RegExp.prototype property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
//CHECK#0
@@ -14,9 +13,16 @@ if (RegExp.hasOwnProperty('prototype') !== true) {
$FAIL('#0: RegExp.hasOwnProperty(\'prototype\') === true');
}
+verifyNotConfigurable(RegExp, "prototype");
+
//CHECK#1
-if (delete RegExp.prototype !== false) {
- $ERROR('#1: delete RegExp.prototype === false');
+try {
+ if (delete RegExp.prototype !== false) {
+ $ERROR('#1: delete RegExp.prototype === false');
+ }
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+ assert(e instanceof TypeError);
}
//CHECK#2
diff --git a/test/built-ins/RegExp/prototype/S15.10.5.1_A4.js b/test/built-ins/RegExp/prototype/S15.10.5.1_A4.js
index 3843e0a24..db97e911b 100644
--- a/test/built-ins/RegExp/prototype/S15.10.5.1_A4.js
+++ b/test/built-ins/RegExp/prototype/S15.10.5.1_A4.js
@@ -5,8 +5,7 @@
info: The RegExp.prototype property has the attribute ReadOnly
es5id: 15.10.5.1_A4
description: Checking if varying the RegExp.prototype property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
//CHECK#1
@@ -14,9 +13,9 @@ if (RegExp.hasOwnProperty('prototype') !== true) {
$FAIL('#1: RegExp.hasOwnProperty(\'prototype\') === true');
}
-__obj = RegExp.prototype;
+var __obj = RegExp.prototype;
-RegExp.prototype = function(){return "shifted";};
+verifyNotWritable(RegExp, "prototype", null, function(){return "shifted";});
//CHECK#2
if (RegExp.prototype !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js b/test/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js
index f68ea5899..d3ecd4035 100644
--- a/test/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js
+++ b/test/built-ins/RegExp/prototype/exec/S15.10.6.2_A10.js
@@ -5,8 +5,7 @@
info: The RegExp.prototype.exec.length property has the attribute ReadOnly
es5id: 15.10.6.2_A10
description: Checking if varying the RegExp.prototype.exec.length property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
//CHECK#1
@@ -14,9 +13,9 @@ if (RegExp.prototype.exec.hasOwnProperty('length') !== true) {
$FAIL('#1: RegExp.prototype.exec.hasOwnProperty(\'length\') === true');
}
-__obj = RegExp.prototype.exec.length;
+var __obj = RegExp.prototype.exec.length;
-RegExp.prototype.exec.length = function(){return "shifted";};
+verifyNotWritable(RegExp.prototype.exec, "length", null, function(){return "shifted";});
//CHECK#2
if (RegExp.prototype.exec.length !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/global/S15.10.7.2_A10.js b/test/built-ins/RegExp/prototype/global/S15.10.7.2_A10.js
index 73c4ff526..c7e605d48 100644
--- a/test/built-ins/RegExp/prototype/global/S15.10.7.2_A10.js
+++ b/test/built-ins/RegExp/prototype/global/S15.10.7.2_A10.js
@@ -5,21 +5,20 @@
info: The RegExp.prototype global property does not have a set accessor
es5id: 15.10.7.2_A10
description: Checking if varying the global property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
-__re = RegExp.prototype;
+var __re = RegExp.prototype;
//CHECK#1
if (__re.hasOwnProperty('global') !== true) {
$FAIL('#1: __re = RegExp.prototype; __re.hasOwnProperty(\'global\') === true');
}
-__sample = /^|^/;
-__obj = __sample.global;
+var __sample = /^|^/;
+var __obj = __sample.global;
-__sample.global = "shifted";
+verifyNotWritable(__sample, "global", "global", "shifted");
//CHECK#2
if (__sample.global !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/ignoreCase/S15.10.7.3_A10.js b/test/built-ins/RegExp/prototype/ignoreCase/S15.10.7.3_A10.js
index 20a02aca1..923032369 100644
--- a/test/built-ins/RegExp/prototype/ignoreCase/S15.10.7.3_A10.js
+++ b/test/built-ins/RegExp/prototype/ignoreCase/S15.10.7.3_A10.js
@@ -5,21 +5,20 @@
info: The RegExp.prototype ignoreCase property does not have a set accessor
es5id: 15.10.7.3_A10
description: Checking if varying the ignoreCase property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
-__re = RegExp.prototype;
+var __re = RegExp.prototype;
//CHECK#1
if (__re.hasOwnProperty('ignoreCase') !== true) {
$FAIL('#1: __re = RegExp.prototype; __re.hasOwnProperty(\'ignoreCase\') === true');
}
-__sample = /a|b|c/;
-__obj = __sample.ignoreCase;
+var __sample = /a|b|c/;
+var __obj = __sample.ignoreCase;
-__sample.ignoreCase = "shifted";
+verifyNotWritable(__sample, "ignoreCase", "ignoreCase", "shifted");
//CHECK#2
if (__sample.ignoreCase !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/lastIndex/S15.10.7.5_A9.js b/test/built-ins/RegExp/prototype/lastIndex/S15.10.7.5_A9.js
index abdf5d21c..fcd56a21d 100644
--- a/test/built-ins/RegExp/prototype/lastIndex/S15.10.7.5_A9.js
+++ b/test/built-ins/RegExp/prototype/lastIndex/S15.10.7.5_A9.js
@@ -5,20 +5,26 @@
info: The RegExp instance lastIndex property has the attribute DontDelete
es5id: 15.10.7.5_A9
description: Checking if deleting the lastIndex property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
-__re = new RegExp;
+var __re = new RegExp;
//CHECK#0
if (__re.hasOwnProperty('lastIndex') !== true) {
$FAIL('#0: __re = new RegExp; __re.hasOwnProperty(\'lastIndex\') === true');
}
+verifyNotConfigurable(__re, "lastIndex");
+
//CHECK#1
-if ((delete __re.lastIndex) !== false) {
- $ERROR('#1: __re = new RegExp; (delete __re.lastIndex) === false');
+try {
+ if ((delete __re.lastIndex) !== false) {
+ $ERROR('#1: __re = new RegExp; (delete __re.lastIndex) === false');
+ }
+} catch (e) {
+ if (e instanceof Test262Error) throw e;
+ assert(e instanceof TypeError);
}
//CHECK#2
diff --git a/test/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js b/test/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js
index 179a1303f..6b6802344 100644
--- a/test/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js
+++ b/test/built-ins/RegExp/prototype/multiline/S15.10.7.4_A10.js
@@ -5,21 +5,20 @@
info: The RegExp.prototype multiline property does not have a set accessor
es5id: 15.10.7.4_A10
description: Checking if varying the multiline property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
-__re = RegExp.prototype;
+var __re = RegExp.prototype;
//CHECK#1
if (__re.hasOwnProperty('multiline') !== true) {
$FAIL('#1: __re = RegExp.prototype; __re.hasOwnProperty(\'multiline\') === true');
}
-__sample = /\n/;
-__obj = __sample.multiline;
+var __sample = /\n/;
+var __obj = __sample.multiline;
-__sample.multiline = "shifted";
+verifyNotWritable(__sample, "multiline", "multiline", "shifted");
//CHECK#2
if (__sample.multiline !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/source/S15.10.7.1_A10.js b/test/built-ins/RegExp/prototype/source/S15.10.7.1_A10.js
index 08fe7e796..85e86d5f4 100644
--- a/test/built-ins/RegExp/prototype/source/S15.10.7.1_A10.js
+++ b/test/built-ins/RegExp/prototype/source/S15.10.7.1_A10.js
@@ -5,21 +5,20 @@
info: The RegExp.prototype source property does not have a set accessor
es5id: 15.10.7.1_A10
description: Checking if varying the source property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
-__re = RegExp.prototype;
+var __re = RegExp.prototype;
//CHECK#1
if (__re.hasOwnProperty('source') !== true) {
$FAIL('#1: __re = RegExp.prototype; __re.hasOwnProperty(\'source\') === true');
}
-__sample = /./;
-__obj = __sample.source;
+var __sample = /./;
+var __obj = __sample.source;
-__sample.source = "shifted";
+verifyNotWritable(__sample, "source", "source", "shifted");
//CHECK#2
if (__sample.source !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/test/S15.10.6.3_A10.js b/test/built-ins/RegExp/prototype/test/S15.10.6.3_A10.js
index 1a0c6bce2..331a32814 100644
--- a/test/built-ins/RegExp/prototype/test/S15.10.6.3_A10.js
+++ b/test/built-ins/RegExp/prototype/test/S15.10.6.3_A10.js
@@ -5,8 +5,7 @@
info: The RegExp.prototype.test.length property has the attribute ReadOnly
es5id: 15.10.6.3_A10
description: Checking if varying the RegExp.prototype.test.length property fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
//CHECK#1
@@ -14,9 +13,9 @@ if (RegExp.prototype.test.hasOwnProperty('length') !== true) {
$FAIL('#1: RegExp.prototype.test.hasOwnProperty(\'length\') === true');
}
-__obj = RegExp.prototype.test.length;
+var __obj = RegExp.prototype.test.length;
-RegExp.prototype.test.length = function(){return "shifted";};
+verifyNotWritable(RegExp.prototype.test, "length", null, function(){return "shifted";});
//CHECK#2
if (RegExp.prototype.test.length !== __obj) {
diff --git a/test/built-ins/RegExp/prototype/toString/S15.10.6.4_A10.js b/test/built-ins/RegExp/prototype/toString/S15.10.6.4_A10.js
index b1de97d0d..ff7e93960 100644
--- a/test/built-ins/RegExp/prototype/toString/S15.10.6.4_A10.js
+++ b/test/built-ins/RegExp/prototype/toString/S15.10.6.4_A10.js
@@ -7,8 +7,7 @@ es5id: 15.10.6.4_A10
description: >
Checking if varying the RegExp.prototype.toString.length property
fails
-flags: [noStrict]
-includes: [$FAIL.js]
+includes: [$FAIL.js, propertyHelper.js]
---*/
//CHECK#1
@@ -16,9 +15,9 @@ if (RegExp.prototype.toString.hasOwnProperty('length') !== true) {
$FAIL('#1: RegExp.prototype.toString.hasOwnProperty(\'length\') === true');
}
-__obj = RegExp.prototype.toString.length;
+var __obj = RegExp.prototype.toString.length;
-RegExp.prototype.toString.length = function(){return "shifted";};
+verifyNotWritable(RegExp.prototype.toString, "length", null, function(){return "shifted";});
//CHECK#2
if (RegExp.prototype.toString.length !== __obj) {