From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../Number/isInteger/arg-is-not-number.js | 26 ++++++++++++++++++ .../test262/built-ins/Number/isInteger/browser.js | 0 .../test262/built-ins/Number/isInteger/infinity.js | 13 +++++++++ .../test262/built-ins/Number/isInteger/integers.js | 19 +++++++++++++ .../test262/built-ins/Number/isInteger/length.js | 31 ++++++++++++++++++++++ .../test262/built-ins/Number/isInteger/name.js | 28 +++++++++++++++++++ .../test262/built-ins/Number/isInteger/nan.js | 12 +++++++++ .../built-ins/Number/isInteger/non-integers.js | 15 +++++++++++ .../Number/isInteger/not-a-constructor.js | 31 ++++++++++++++++++++++ .../built-ins/Number/isInteger/prop-desc.js | 21 +++++++++++++++ .../test262/built-ins/Number/isInteger/shell.js | 0 11 files changed, 196 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/arg-is-not-number.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/browser.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/infinity.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/integers.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/length.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/name.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/nan.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/non-integers.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/prop-desc.js create mode 100644 js/src/tests/test262/built-ins/Number/isInteger/shell.js (limited to 'js/src/tests/test262/built-ins/Number/isInteger') diff --git a/js/src/tests/test262/built-ins/Number/isInteger/arg-is-not-number.js b/js/src/tests/test262/built-ins/Number/isInteger/arg-is-not-number.js new file mode 100644 index 0000000000..59aa03c750 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/arg-is-not-number.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-number.isinteger +description: > + Return false if argument is not Number +info: | + Number.isInteger ( number ) + + 1. If Type(number) is not Number, return false. + [...] +features: [Symbol] +---*/ + +assert.sameValue(Number.isInteger("1"), false, "string"); +assert.sameValue(Number.isInteger([1]), false, "[1]"); +assert.sameValue(Number.isInteger(new Number(42)), false, "Number object"); +assert.sameValue(Number.isInteger(false), false, "false"); +assert.sameValue(Number.isInteger(true), false, "true"); +assert.sameValue(Number.isInteger(undefined), false, "undefined"); +assert.sameValue(Number.isInteger(null), false, "null"); +assert.sameValue(Number.isInteger(Symbol("1")), false, "symbol"); +assert.sameValue(Number.isInteger(), false, "no arg"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/browser.js b/js/src/tests/test262/built-ins/Number/isInteger/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Number/isInteger/infinity.js b/js/src/tests/test262/built-ins/Number/isInteger/infinity.js new file mode 100644 index 0000000000..5988e69f33 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/infinity.js @@ -0,0 +1,13 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.3 +author: Ryan Lewis +description: Number.isInteger should return false if called with Infinity. +---*/ + +assert.sameValue(Number.isInteger(Infinity), false, 'Infinity'); +assert.sameValue(Number.isInteger(-Infinity), false, '-Infinity'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/integers.js b/js/src/tests/test262/built-ins/Number/isInteger/integers.js new file mode 100644 index 0000000000..b3110dd8f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/integers.js @@ -0,0 +1,19 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.3 +author: Ryan Lewis +description: Number.isInteger should return true if called with an integer. +---*/ + +assert.sameValue(Number.isInteger(478), true, 'Number.isInteger(478)'); +assert.sameValue(Number.isInteger(-0), true, '-0'); +assert.sameValue(Number.isInteger(0), true, '0'); +assert.sameValue(Number.isInteger(-1), true, '-1'); +assert.sameValue(Number.isInteger(9007199254740991), true, '9007199254740991'); +assert.sameValue(Number.isInteger(-9007199254740991), true, '-9007199254740991'); +assert.sameValue(Number.isInteger(9007199254740992), true, '9007199254740992'); +assert.sameValue(Number.isInteger(-9007199254740992), true, '-9007199254740992'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/length.js b/js/src/tests/test262/built-ins/Number/isInteger/length.js new file mode 100644 index 0000000000..99bd2d168f --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.3 +description: > + Number.isInteger.length is 1. +info: | + Number.isInteger ( number ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, has a length + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description, including optional + parameters. However, rest parameters shown using the form “...name” + are not included in the default argument count. + + Unless otherwise specified, the length property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Number.isInteger.length, 1); + +verifyNotEnumerable(Number.isInteger, "length"); +verifyNotWritable(Number.isInteger, "length"); +verifyConfigurable(Number.isInteger, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/name.js b/js/src/tests/test262/built-ins/Number/isInteger/name.js new file mode 100644 index 0000000000..224c94dba9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.3 +description: > + Number.isInteger.name is "isInteger". +info: | + Number.isInteger ( number ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Number.isInteger.name, "isInteger"); + +verifyNotEnumerable(Number.isInteger, "name"); +verifyNotWritable(Number.isInteger, "name"); +verifyConfigurable(Number.isInteger, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/nan.js b/js/src/tests/test262/built-ins/Number/isInteger/nan.js new file mode 100644 index 0000000000..b367702f3c --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/nan.js @@ -0,0 +1,12 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.3 +author: Ryan Lewis +description: Number.isInteger should return false if called with NaN. +---*/ + +assert.sameValue(Number.isInteger(NaN), false, 'Number.isInteger(NaN)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/non-integers.js b/js/src/tests/test262/built-ins/Number/isInteger/non-integers.js new file mode 100644 index 0000000000..78a3857ec7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/non-integers.js @@ -0,0 +1,15 @@ +// Copyright (c) 2014 Ryan Lewis. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 20.1.2.3 +author: Ryan Lewis +description: Number.isInteger should return false if called with a double. +---*/ + +assert.sameValue(Number.isInteger(6.75), false, '6.75'); +assert.sameValue(Number.isInteger(0.000001), false, '0.000001'); +assert.sameValue(Number.isInteger(-0.000001), false, '-0.000001'); +assert.sameValue(Number.isInteger(11e-1), false, '11e-1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/not-a-constructor.js b/js/src/tests/test262/built-ins/Number/isInteger/not-a-constructor.js new file mode 100644 index 0000000000..2dad2e9df7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Number.isInteger does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Number.isInteger), false, 'isConstructor(Number.isInteger) must return false'); + +assert.throws(TypeError, () => { + new Number.isInteger(); +}, '`new Number.isInteger()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/prop-desc.js b/js/src/tests/test262/built-ins/Number/isInteger/prop-desc.js new file mode 100644 index 0000000000..ed31b7bc65 --- /dev/null +++ b/js/src/tests/test262/built-ins/Number/isInteger/prop-desc.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-number.isinteger +description: > + "isInteger" property of Number +info: | + 17 ECMAScript Standard Built-in Objects: + + Every other data property described in clauses 18 through 26 and in Annex B.2 + has the attributes { [[Writable]]: true, [[Enumerable]]: false, + [[Configurable]]: true } unless otherwise specified. +includes: [propertyHelper.js] +---*/ + +verifyNotEnumerable(Number, "isInteger"); +verifyWritable(Number, "isInteger"); +verifyConfigurable(Number, "isInteger"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Number/isInteger/shell.js b/js/src/tests/test262/built-ins/Number/isInteger/shell.js new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3