diff options
author | André Bargull <andre.bargull@gmail.com> | 2017-12-21 12:08:30 -0800 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2017-12-21 16:46:56 -0500 |
commit | 266e0ffb668e085ced28c146818766f3a62547cc (patch) | |
tree | bfe5ee6c8a699328ad9ec16acc8af9c8c6f8cfd4 | |
parent | 60692bb6e06680cabb4f603883d274d8339d09fe (diff) | |
download | qtdeclarative-testsuites-266e0ffb668e085ced28c146818766f3a62547cc.tar.gz |
Remove harness/testBuiltInObject.js file
-rw-r--r-- | INTERPRETING.md | 9 | ||||
-rw-r--r-- | harness/testBuiltInObject.js | 58 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-function-badstring.js | 26 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-function-expected-length.js | 26 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-function-not-constructor-no-error.js | 26 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-function-not-constructor-no-typeerror.js | 29 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-non-extensible.js | 27 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-not-function-badstring.js | 26 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-prop-enumerable.js | 36 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-prop-missing.js | 33 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-prop-not-configurable.js | 36 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-prop-not-writable.js | 36 | ||||
-rw-r--r-- | test/harness/testbuiltinobject-undefined.js | 25 |
13 files changed, 7 insertions, 386 deletions
diff --git a/INTERPRETING.md b/INTERPRETING.md index 54e541800..1b46c10b0 100644 --- a/INTERPRETING.md +++ b/INTERPRETING.md @@ -191,9 +191,14 @@ directory of the Test262 project. ```js /*--- -includes: [testBuildInObject.js] +includes: [propertyHelper.js] ---*/ -testBuiltInObject(Number.prototype.toLocaleString, true, false, [], 0); +verifyProperty(this, "Object", { + value: Object, + writable: true, + enumerable: false, + configurable: true, +}); ``` ### `flags` diff --git a/harness/testBuiltInObject.js b/harness/testBuiltInObject.js deleted file mode 100644 index af0081c87..000000000 --- a/harness/testBuiltInObject.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2012 Mozilla Corporation. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -description: | - A function used to assert the correctness of built-in objects. ----*/ - -/** - * @description Tests that obj meets the requirements for built-in objects - * defined by the introduction of chapter 15 of the ECMAScript Language Specification. - * @param {Object} obj the object to be tested. - * @author Norbert Lindenberg - */ - -function testBuiltInObject(obj) { - - if (obj === undefined) { - $ERROR("Object being tested is undefined."); - } - - var objString = Object.prototype.toString.call(obj); - - if (objString !== "[object Function]") { - $ERROR("The [[Class]] internal property of a built-in function must be " + - "\"Function\", but toString() returns " + objString); - } - - if (!Object.isExtensible(obj)) { - $ERROR("Built-in objects must be extensible."); - } - - if (Object.getPrototypeOf(obj) !== Function.prototype) { - $ERROR("Built-in functions must have Function.prototype as their prototype."); - } - - var exception; - // this is not a complete test for the presence of [[Construct]]: - // if it's absent, the exception must be thrown, but it may also - // be thrown if it's present and just has preconditions related to - // arguments or the this value that this statement doesn't meet. - try { - /*jshint newcap:false*/ - var instance = new obj(); - } catch (e) { - exception = e; - } - if (exception === undefined || exception.name !== "TypeError") { - $ERROR("Built-in functions that aren't constructors must throw TypeError when " + - "used in a \"new\" statement."); - } - - if (obj.hasOwnProperty("prototype")) { - $ERROR("Built-in functions that aren't constructors must not have a prototype property."); - } - - // passed the complete test! - return true; -} diff --git a/test/harness/testbuiltinobject-function-badstring.js b/test/harness/testbuiltinobject-function-badstring.js deleted file mode 100644 index 7340fdad3..000000000 --- a/test/harness/testbuiltinobject-function-badstring.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that are expected to be functions but do not define the correct - [[Class]] internal property do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; - -try { - testBuiltInObject(null, true); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-function-expected-length.js b/test/harness/testbuiltinobject-function-expected-length.js deleted file mode 100644 index 1503384bd..000000000 --- a/test/harness/testbuiltinobject-function-expected-length.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Functions whose `length` property does not match the expected value do not - satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; - -try { - testBuiltInObject(function(a, b) {}, true, false, [], 3); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-function-not-constructor-no-error.js b/test/harness/testbuiltinobject-function-not-constructor-no-error.js deleted file mode 100644 index a33597184..000000000 --- a/test/harness/testbuiltinobject-function-not-constructor-no-error.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Non-constructor functions that do not throw an when invoked via `new` do - not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; - -try { - testBuiltInObject(function() {}, true, false, [], 0); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-function-not-constructor-no-typeerror.js b/test/harness/testbuiltinobject-function-not-constructor-no-typeerror.js deleted file mode 100644 index 10720ad1a..000000000 --- a/test/harness/testbuiltinobject-function-not-constructor-no-typeerror.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Non-constructor functions that do not throw a TypeError when invoked via - `new` do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; -var fn = function() { - throw new Error(); -}; - -try { - testBuiltInObject(fn, true, false, [], 0); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-non-extensible.js b/test/harness/testbuiltinobject-non-extensible.js deleted file mode 100644 index 7e1565cb8..000000000 --- a/test/harness/testbuiltinobject-non-extensible.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that are not extensible do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; -var obj = {}; -Object.preventExtensions(obj); - -try { - testBuiltInObject(obj); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-not-function-badstring.js b/test/harness/testbuiltinobject-not-function-badstring.js deleted file mode 100644 index 00223284c..000000000 --- a/test/harness/testbuiltinobject-not-function-badstring.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that are not expected to be functions but do not define the correct - [[Class]] internal property do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; - -try { - testBuiltInObject(function() {}, false); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-prop-enumerable.js b/test/harness/testbuiltinobject-prop-enumerable.js deleted file mode 100644 index fdceb5487..000000000 --- a/test/harness/testbuiltinobject-prop-enumerable.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that do not define all of the specified "own" properties as - non-enumerable do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; -var obj = {}; -Object.defineProperty(obj, 'a', { - writable: true, enumerable: false, configurable: true -}); -Object.defineProperty(obj, 'b', { - writable: true, enumerable: true, configurable: true -}); -Object.defineProperty(obj, 'c', { - writable: true, enumerable: false, configurable: true -}); - -try { - testBuiltInObject(obj, false, false, ['a', 'b', 'c']); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-prop-missing.js b/test/harness/testbuiltinobject-prop-missing.js deleted file mode 100644 index f27ab008f..000000000 --- a/test/harness/testbuiltinobject-prop-missing.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that do not define all of the specified "own" properties do not - satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; -var obj = {}; -Object.defineProperty(obj, 'a', { - writable: true, enumerable: false, configurable: true -}); -Object.defineProperty(obj, 'c', { - writable: true, enumerable: false, configurable: true -}); - -try { - testBuiltInObject(obj, false, false, ['a', 'b', 'c']); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-prop-not-configurable.js b/test/harness/testbuiltinobject-prop-not-configurable.js deleted file mode 100644 index 9ad2c8d61..000000000 --- a/test/harness/testbuiltinobject-prop-not-configurable.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that do not define all of the specified "own" properties as - configurable do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; -var obj = {}; -Object.defineProperty(obj, 'a', { - writable: true, enumerable: false, configurable: true -}); -Object.defineProperty(obj, 'b', { - writable: true, enumerable: false, configurable: false -}); -Object.defineProperty(obj, 'c', { - writable: true, enumerable: false, configurable: true -}); - -try { - testBuiltInObject(obj, false, false, ['a', 'b', 'c']); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-prop-not-writable.js b/test/harness/testbuiltinobject-prop-not-writable.js deleted file mode 100644 index af816a270..000000000 --- a/test/harness/testbuiltinobject-prop-not-writable.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Objects that do not define all of the specified "own" properties as - writable do not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; -var obj = {}; -Object.defineProperty(obj, 'a', { - writable: true, enumerable: false, configurable: true -}); -Object.defineProperty(obj, 'b', { - writable: false, enumerable: false, configurable: true -}); -Object.defineProperty(obj, 'c', { - writable: true, enumerable: false, configurable: true -}); - -try { - testBuiltInObject(obj, false, false, ['a', 'b', 'c']); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} diff --git a/test/harness/testbuiltinobject-undefined.js b/test/harness/testbuiltinobject-undefined.js deleted file mode 100644 index 408ea6942..000000000 --- a/test/harness/testbuiltinobject-undefined.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2015 the V8 project authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - `undefined` does not satisfy the assertion. -includes: [testBuiltInObject.js,sta.js] ----*/ -var threw = false; - -try { - testBuiltInObject(undefined); -} catch(err) { - threw = true; - if (err.constructor !== Test262Error) { - $ERROR( - 'Expected a Test262Error, but a "' + err.constructor.name + - '" was thrown.' - ); - } -} - -if (threw === false) { - $ERROR('Expected a Test262Error, but no error was thrown.'); -} |