summaryrefslogtreecommitdiff
path: root/test/built-ins
diff options
context:
space:
mode:
authorMike Pennisi <mike@mikepennisi.com>2015-06-16 12:35:27 -0400
committerMike Pennisi <mike@mikepennisi.com>2015-06-16 12:55:56 -0400
commit57f3466cf718e017fcbeea9de72404885ad05219 (patch)
tree93077ee43ef38d375da96f4cea99be41e103a7ff /test/built-ins
parente4aac334b87bf0c22a91205bb36ea28b02dcb8a2 (diff)
downloadqtdeclarative-testsuites-57f3466cf718e017fcbeea9de72404885ad05219.tar.gz
Fix tautological pattern in tests
In neglecting to assert the type of error thrown (or that any error was thrown at all), these tests cannot fail. Refactor the tests to use the `assert.throws` helper method, which takes these details into consideration.
Diffstat (limited to 'test/built-ins')
-rw-r--r--test/built-ins/Function/prototype/S15.3.4_A5.js13
-rw-r--r--test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js11
-rw-r--r--test/built-ins/Object/prototype/S15.2.4_A3.js10
-rw-r--r--test/built-ins/Object/prototype/S15.2.4_A4.js12
-rw-r--r--test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js10
-rw-r--r--test/built-ins/Object/prototype/isPrototypeOf/S15.2.4.6_A7.js12
-rw-r--r--test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js12
-rw-r--r--test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js12
-rw-r--r--test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js11
-rw-r--r--test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js10
-rw-r--r--test/built-ins/String/prototype/lastIndexOf/S15.5.4.8_A7.js13
-rw-r--r--test/built-ins/String/prototype/slice/S15.5.4.13_A7.js13
12 files changed, 37 insertions, 102 deletions
diff --git a/test/built-ins/Function/prototype/S15.3.4_A5.js b/test/built-ins/Function/prototype/S15.3.4_A5.js
index e691fb2f8..49886228f 100644
--- a/test/built-ins/Function/prototype/S15.3.4_A5.js
+++ b/test/built-ins/Function/prototype/S15.3.4_A5.js
@@ -7,15 +7,8 @@ info: >
[[Construct]] property
es5id: 15.3.4_A5
description: Checking if creating "new Function.prototype object" fails
-includes:
- - $PRINT.js
---*/
-//CHECK#
-try {
- var obj = new Function.prototype;
- $ERROR('#1: The Function prototype object is itself a Function object without [[Construct]] property: '+e);
-} catch (e) {
- $PRINT("#1.1: The Function prototype object is itself a Function object without [[Construct]] property "+e);
-
-}
+assert.throws(TypeError, function() {
+ new Function.prototype;
+});
diff --git a/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js b/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js
index c6d46fcae..ef8ce2695 100644
--- a/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js
+++ b/test/built-ins/Function/prototype/toString/S15.3.4.2_A7.js
@@ -5,15 +5,10 @@
info: Function.prototype.toString can't be used as constructor
es5id: 15.3.4.2_A7
description: Checking if creating "new Function.prototype.toString" fails
-includes:
- - $PRINT.js
---*/
var FACTORY = Function.prototype.toString;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Function.prototype.toString can\'t be used as constructor');
-} catch (e) {
- $PRINT(e);
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/Object/prototype/S15.2.4_A3.js b/test/built-ins/Object/prototype/S15.2.4_A3.js
index 4f8f3bad8..3afac8afb 100644
--- a/test/built-ins/Object/prototype/S15.2.4_A3.js
+++ b/test/built-ins/Object/prototype/S15.2.4_A3.js
@@ -7,14 +7,8 @@ info: >
method
es5id: 15.2.4_A3
description: Checking if calling Object prototype as a function fails
-includes:
- - $PRINT.js
---*/
-//CHECK#1
-try {
+assert.throws(TypeError, function() {
Object.prototype();
- $ERROR('#1: Since Object prototype object is not function it has not [[call]] method');
-} catch (e) {
- $PRINT(e);
-}
+});
diff --git a/test/built-ins/Object/prototype/S15.2.4_A4.js b/test/built-ins/Object/prototype/S15.2.4_A4.js
index 8cff6c8f4..3f575d5fa 100644
--- a/test/built-ins/Object/prototype/S15.2.4_A4.js
+++ b/test/built-ins/Object/prototype/S15.2.4_A4.js
@@ -7,14 +7,8 @@ info: >
[[create]] method
es5id: 15.2.4_A4
description: Checking if creating "new Object.prototype" fails
-includes:
- - $PRINT.js
---*/
-//CHECK#1
-try {
- var instance = new Object.prototype;
- $ERROR('#1: Since Object prototype object is not function it has not [[create]] method');
-} catch (e) {
- $PRINT(e);
-}
+assert.throws(TypeError, function() {
+ new Object.prototype;
+});
diff --git a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js
index 228b00b07..a6480454e 100644
--- a/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js
+++ b/test/built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A7.js
@@ -11,10 +11,6 @@ includes:
var FACTORY = Object.prototype.hasOwnProperty;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Object.prototype.hasOwnProperty can\'t be used as a constructor');
-} catch (e) {
- $PRINT(e);
-
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/Object/prototype/isPrototypeOf/S15.2.4.6_A7.js b/test/built-ins/Object/prototype/isPrototypeOf/S15.2.4.6_A7.js
index 410f91bb6..5e9bf6d46 100644
--- a/test/built-ins/Object/prototype/isPrototypeOf/S15.2.4.6_A7.js
+++ b/test/built-ins/Object/prototype/isPrototypeOf/S15.2.4.6_A7.js
@@ -5,16 +5,10 @@
info: Object.prototype.isPrototypeOf can't be used as a constructor
es5id: 15.2.4.6_A7
description: Checking if creating new "Object.prototype.isPrototypeOf" fails
-includes:
- - $PRINT.js
---*/
var FACTORY = Object.prototype.isPrototypeOf;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Object.prototype.isPrototypeOf can\'t be used as a constructor');
-} catch (e) {
- $PRINT(e);
-
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js
index 34821898f..98ac74a12 100644
--- a/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js
+++ b/test/built-ins/Object/prototype/propertyIsEnumerable/S15.2.4.7_A7.js
@@ -7,16 +7,10 @@ es5id: 15.2.4.7_A7
description: >
Checking if creating "new Object.prototype.propertyIsEnumerable"
fails
-includes:
- - $PRINT.js
---*/
var FACTORY = Object.prototype.propertyIsEnumerable;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Object.prototype.propertyIsEnumerable can\'t be used as a constructor');
-} catch (e) {
- $PRINT(e);
-
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js
index 5567a3fb8..b18651235 100644
--- a/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js
+++ b/test/built-ins/Object/prototype/toLocaleString/S15.2.4.3_A7.js
@@ -5,16 +5,10 @@
info: Object.prototype.toLocaleString can't be used as a constructor
es5id: 15.2.4.3_A7
description: Checking if creating "new Object.prototype.toLocaleString" fails
-includes:
- - $PRINT.js
---*/
var FACTORY = Object.prototype.toLocaleString;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Object.prototype.toLocaleString can\'t be used as a constructor');
-} catch (e) {
- $PRINT(e);
-
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js b/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js
index ea58f028e..99e331d7d 100644
--- a/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js
+++ b/test/built-ins/Object/prototype/toString/S15.2.4.2_A7.js
@@ -5,15 +5,10 @@
info: Object.prototype.toString can't be used as a constructor
es5id: 15.2.4.2_A7
description: Checking if creating "new Object.prototype.toString" fails
-includes:
- - $PRINT.js
---*/
var FACTORY = Object.prototype.toString;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Object.prototype.toString can\'t be used as a constructor');
-} catch (e) {
- $PRINT(e);
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js
index 902fa142a..44490329c 100644
--- a/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js
+++ b/test/built-ins/Object/prototype/valueOf/S15.2.4.4_A7.js
@@ -11,10 +11,6 @@ includes:
var FACTORY = Object.prototype.valueOf;
-try {
- var instance = new FACTORY;
- $ERROR('#1: Object.prototype.valueOf can\'t be used as a constructor');
-} catch (e) {
- $PRINT(e);
-
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/String/prototype/lastIndexOf/S15.5.4.8_A7.js b/test/built-ins/String/prototype/lastIndexOf/S15.5.4.8_A7.js
index a9e197228..40a0c4941 100644
--- a/test/built-ins/String/prototype/lastIndexOf/S15.5.4.8_A7.js
+++ b/test/built-ins/String/prototype/lastIndexOf/S15.5.4.8_A7.js
@@ -5,15 +5,10 @@
info: String.prototype.lastIndexOf can't be used as constructor
es5id: 15.5.4.8_A7
description: Checking if creating the String.prototype.lastIndexOf object fails
-includes:
- - $PRINT.js
---*/
-var __FACTORY = String.prototype.lastIndexOf;
+var FACTORY = String.prototype.lastIndexOf;
-try {
- var __instance = new __FACTORY;
- $ERROR('#1: __FACTORY = String.prototype.lastIndexOf; __instance = new __FACTORY lead to throwing exception');
-} catch (e) {
- $PRINT(e);
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});
diff --git a/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js b/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js
index 7246b6d8f..deba84f20 100644
--- a/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js
+++ b/test/built-ins/String/prototype/slice/S15.5.4.13_A7.js
@@ -5,15 +5,10 @@
info: String.prototype.slice can't be used as constructor
es5id: 15.5.4.13_A7
description: Checking if creating the String.prototype.slice object fails
-includes:
- - $PRINT.js
---*/
-var __FACTORY = String.prototype.slice;
+var FACTORY = String.prototype.slice;
-try {
- var __instance = new __FACTORY;
- $ERROR('#1: __FACTORY = String.prototype.slice; "__instance = new __FACTORY" lead to throwing exception');
-} catch (e) {
- $PRINT(e);
-}
+assert.throws(TypeError, function() {
+ new FACTORY;
+});