summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/isFinite
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/isFinite')
-rw-r--r--js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.6.js11
-rw-r--r--js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.7.js17
-rw-r--r--js/src/tests/test262/built-ins/isFinite/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/isFinite/length.js17
-rw-r--r--js/src/tests/test262/built-ins/isFinite/name.js28
-rw-r--r--js/src/tests/test262/built-ins/isFinite/not-a-constructor.js31
-rw-r--r--js/src/tests/test262/built-ins/isFinite/prop-desc.js15
-rw-r--r--js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number-symbol.js21
-rw-r--r--js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number.js34
-rw-r--r--js/src/tests/test262/built-ins/isFinite/return-false-on-nan-or-infinities.js19
-rw-r--r--js/src/tests/test262/built-ins/isFinite/return-true-for-valid-finite-numbers.js27
-rw-r--r--js/src/tests/test262/built-ins/isFinite/shell.js24
-rw-r--r--js/src/tests/test262/built-ins/isFinite/tonumber-operations.js29
-rw-r--r--js/src/tests/test262/built-ins/isFinite/toprimitive-call-abrupt.js31
-rw-r--r--js/src/tests/test262/built-ins/isFinite/toprimitive-get-abrupt.js30
-rw-r--r--js/src/tests/test262/built-ins/isFinite/toprimitive-not-callable-throws.js54
-rw-r--r--js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-object-throws.js33
-rw-r--r--js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-symbol-throws.js37
-rw-r--r--js/src/tests/test262/built-ins/isFinite/toprimitive-valid-result.js82
19 files changed, 540 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.6.js b/js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.6.js
new file mode 100644
index 0000000000..ad528bb250
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.6.js
@@ -0,0 +1,11 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The isFinite property has not prototype property
+esid: sec-isfinite-number
+description: Checking isFinite.prototype
+---*/
+assert.sameValue(isFinite.prototype, undefined, 'The value of isFinite.prototype is expected to equal undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.7.js b/js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.7.js
new file mode 100644
index 0000000000..2ec5c31ed4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/S15.1.2.5_A2.7.js
@@ -0,0 +1,17 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The isFinite property can't be used as constructor
+esid: sec-isfinite-number
+description: >
+ If property does not implement the internal [[Construct]] method,
+ throw a TypeError exception
+---*/
+
+assert.throws(TypeError, () => {
+ new isFinite();
+ throw new Test262Error();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/browser.js b/js/src/tests/test262/built-ins/isFinite/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/browser.js
diff --git a/js/src/tests/test262/built-ins/isFinite/length.js b/js/src/tests/test262/built-ins/isFinite/length.js
new file mode 100644
index 0000000000..6d18559474
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/length.js
@@ -0,0 +1,17 @@
+// 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-isfinite-number
+description: >
+ The length property of isFinite is 1
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(isFinite.length, 1, "The value of `isFinite.length` is `1`");
+
+verifyNotEnumerable(isFinite, "length");
+verifyNotWritable(isFinite, "length");
+verifyConfigurable(isFinite, "length");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/name.js b/js/src/tests/test262/built-ins/isFinite/name.js
new file mode 100644
index 0000000000..46da43f25c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/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.
+
+/*---
+esid: sec-isfinite-number
+description: >
+ isFinite.name is "isFinite".
+info: |
+ isFinite (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(isFinite.name, "isFinite");
+
+verifyNotEnumerable(isFinite, "name");
+verifyNotWritable(isFinite, "name");
+verifyConfigurable(isFinite, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/not-a-constructor.js b/js/src/tests/test262/built-ins/isFinite/not-a-constructor.js
new file mode 100644
index 0000000000..465d6f20e5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/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: >
+ isFinite 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(isFinite), false, 'isConstructor(isFinite) must return false');
+
+assert.throws(TypeError, () => {
+ new isFinite(1);
+}, '`new isFinite(1)` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/prop-desc.js b/js/src/tests/test262/built-ins/isFinite/prop-desc.js
new file mode 100644
index 0000000000..ae42365a08
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/prop-desc.js
@@ -0,0 +1,15 @@
+// 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-isfinite-number
+description: >
+ Property descriptor for isFinite
+includes: [propertyHelper.js]
+---*/
+
+verifyNotEnumerable(this, "isFinite");
+verifyWritable(this, "isFinite");
+verifyConfigurable(this, "isFinite");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number-symbol.js b/js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number-symbol.js
new file mode 100644
index 0000000000..dcdd07b5d5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number-symbol.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-isfinite-number
+description: >
+ Throws a TypeError if number is a Symbol
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+features: [Symbol]
+---*/
+
+var s = Symbol(1);
+
+assert.throws(TypeError, function() {
+ isFinite(s);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number.js b/js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number.js
new file mode 100644
index 0000000000..95197617fe
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/return-abrupt-from-tonumber-number.js
@@ -0,0 +1,34 @@
+// 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-isfinite-number
+description: >
+ Return abrupt completion from ToNumber(number)
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+---*/
+
+var obj1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ throw new Test262Error();
+ }
+};
+
+assert.throws(Test262Error, function() {
+ isFinite(obj1);
+}, "valueOf");
+
+assert.throws(Test262Error, function() {
+ isFinite(obj2);
+}, "toString");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/return-false-on-nan-or-infinities.js b/js/src/tests/test262/built-ins/isFinite/return-false-on-nan-or-infinities.js
new file mode 100644
index 0000000000..696674a749
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/return-false-on-nan-or-infinities.js
@@ -0,0 +1,19 @@
+// 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-isfinite-number
+description: >
+ Return false if number is NaN, Infinity or -Infinity
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+ 2. If num is NaN, +∞, or -∞, return false.
+---*/
+
+assert.sameValue(isFinite(NaN), false, "NaN");
+assert.sameValue(isFinite(Infinity), false, "Infinity");
+assert.sameValue(isFinite(-Infinity), false, "-Infinity");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/return-true-for-valid-finite-numbers.js b/js/src/tests/test262/built-ins/isFinite/return-true-for-valid-finite-numbers.js
new file mode 100644
index 0000000000..6cca85b977
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/return-true-for-valid-finite-numbers.js
@@ -0,0 +1,27 @@
+// 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-isfinite-number
+description: >
+ Return true if number is not NaN, Infinity or -Infinity
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+ 2. If num is NaN, +∞, or -∞, return false.
+ 3. Otherwise, return true.
+---*/
+
+assert.sameValue(isFinite(0), true, "0");
+assert.sameValue(isFinite(-0), true, "-0");
+assert.sameValue(isFinite(Math.pow(2, 53)), true, "Math.pow(2, 53)");
+assert.sameValue(isFinite(-Math.pow(2, 53)), true, "-Math.pow(2, 53)");
+assert.sameValue(isFinite(1), true, "1");
+assert.sameValue(isFinite(-1), true, "-1");
+assert.sameValue(isFinite(0.000001), true, "0.000001");
+assert.sameValue(isFinite(-0.000001), true, "-0.000001");
+assert.sameValue(isFinite(1e42), true, "1e42");
+assert.sameValue(isFinite(-1e42), true, "-1e42");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/shell.js b/js/src/tests/test262/built-ins/isFinite/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/shell.js
@@ -0,0 +1,24 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/built-ins/isFinite/tonumber-operations.js b/js/src/tests/test262/built-ins/isFinite/tonumber-operations.js
new file mode 100644
index 0000000000..9861e349e7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/tonumber-operations.js
@@ -0,0 +1,29 @@
+// 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-isfinite-number
+description: >
+ number argument is converted by ToNumber
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+ 2. If num is NaN, +∞, or -∞, return false.
+ 3. Otherwise, return true.
+---*/
+
+assert.sameValue(isFinite("0"), true, "'0'");
+assert.sameValue(isFinite(""), true, "the empty string");
+assert.sameValue(isFinite("Infinity"), false, "'Infinity'");
+assert.sameValue(isFinite("this is not a number"), false, "string");
+assert.sameValue(isFinite(true), true, "true");
+assert.sameValue(isFinite(false), true, "false");
+assert.sameValue(isFinite([1]), true, "Object [1]");
+assert.sameValue(isFinite([Infinity]), false, "Object [Infinity]");
+assert.sameValue(isFinite([NaN]), false, "Object [NaN]");
+assert.sameValue(isFinite(null), true, "null");
+assert.sameValue(isFinite(undefined), false, "undefined");
+assert.sameValue(isFinite(), false, "no arg");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/toprimitive-call-abrupt.js b/js/src/tests/test262/built-ins/isFinite/toprimitive-call-abrupt.js
new file mode 100644
index 0000000000..590e88d1dc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/toprimitive-call-abrupt.js
@@ -0,0 +1,31 @@
+// 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-isfinite-number
+description: >
+ Return abrupt completion calling number.@@toPrimitive
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+
+ ToPrimitive ( input [ , PreferredType ] )
+
+ [...]
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+features: [Symbol.toPrimitive]
+---*/
+
+var obj = {};
+obj[Symbol.toPrimitive] = function() {
+ throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+ isFinite(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/toprimitive-get-abrupt.js b/js/src/tests/test262/built-ins/isFinite/toprimitive-get-abrupt.js
new file mode 100644
index 0000000000..8dd72cdfef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/toprimitive-get-abrupt.js
@@ -0,0 +1,30 @@
+// 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-isfinite-number
+description: >
+ Return abrupt completion getting number.@@toPrimitive
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+
+ ToPrimitive ( input [ , PreferredType ] )
+
+ [...]
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+features: [Symbol.toPrimitive]
+---*/
+
+var obj = Object.defineProperty({}, Symbol.toPrimitive, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ isFinite(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/toprimitive-not-callable-throws.js b/js/src/tests/test262/built-ins/isFinite/toprimitive-not-callable-throws.js
new file mode 100644
index 0000000000..04a141344f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/toprimitive-not-callable-throws.js
@@ -0,0 +1,54 @@
+// 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-isfinite-number
+description: >
+ Throws a TypeError if number.@@toPrimitive is not null, undefined, or callable
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+
+ ToPrimitive ( input [ , PreferredType ] )
+
+ [...]
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+
+ GetMethod (V, P)
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+features: [Symbol.toPrimitive]
+---*/
+
+var obj = {};
+
+obj[Symbol.toPrimitive] = 42;
+assert.throws(TypeError, function() {
+ isFinite(obj);
+}, "number");
+
+obj[Symbol.toPrimitive] = "";
+assert.throws(TypeError, function() {
+ isFinite(obj);
+}, "string");
+
+obj[Symbol.toPrimitive] = true;
+assert.throws(TypeError, function() {
+ isFinite(obj);
+}, "boolean");
+
+obj[Symbol.toPrimitive] = Symbol.toPrimitive;
+assert.throws(TypeError, function() {
+ isFinite(obj);
+}, "symbol");
+
+obj[Symbol.toPrimitive] = {};
+assert.throws(TypeError, function() {
+ isFinite(obj);
+}, "object");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-object-throws.js b/js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-object-throws.js
new file mode 100644
index 0000000000..aa9157564f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-object-throws.js
@@ -0,0 +1,33 @@
+// 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-isfinite-number
+description: >
+ Throws a TypeError if the result of calling number.@@toPrimitive is an Object
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+
+ ToPrimitive ( input [ , PreferredType ] )
+
+ [...]
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+ c. Throw a TypeError exception.
+features: [Symbol.toPrimitive]
+---*/
+
+var obj = {};
+obj[Symbol.toPrimitive] = function() {
+ return [42];
+};
+
+assert.throws(TypeError, function() {
+ isFinite(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-symbol-throws.js b/js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-symbol-throws.js
new file mode 100644
index 0000000000..c02e105024
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/toprimitive-result-is-symbol-throws.js
@@ -0,0 +1,37 @@
+// 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-isfinite-number
+description: >
+ Throws a TypeError if the result of calling number.@@toPrimitive is a symbol
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+
+ ToNumber ( argument )
+
+ 1. Let primValue be ? ToPrimitive(argument, hint Number).
+ 2. Return ? ToNumber(primValue).
+
+ ToPrimitive ( input [ , PreferredType ] )
+
+ [...]
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+features: [Symbol.toPrimitive]
+---*/
+
+var obj = {};
+obj[Symbol.toPrimitive] = function() {
+ return Symbol.toPrimitive;
+};
+
+assert.throws(TypeError, function() {
+ isFinite(obj);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/isFinite/toprimitive-valid-result.js b/js/src/tests/test262/built-ins/isFinite/toprimitive-valid-result.js
new file mode 100644
index 0000000000..16fdc97936
--- /dev/null
+++ b/js/src/tests/test262/built-ins/isFinite/toprimitive-valid-result.js
@@ -0,0 +1,82 @@
+// 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-isfinite-number
+description: >
+ Use non-object value returned from @@toPrimitive method
+info: |
+ isFinite (number)
+
+ 1. Let num be ? ToNumber(number).
+
+ ToPrimitive ( input [ , PreferredType ] )
+
+ [...]
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+features: [Symbol.toPrimitive]
+---*/
+
+var called = 0;
+var obj = {
+ valueOf: function() {
+ called = NaN;
+ return Infinity;
+ },
+ toString: function() {
+ called = NaN;
+ return Infinity;
+ }
+};
+
+obj[Symbol.toPrimitive] = function() {
+ called += 1;
+ return 42;
+};
+assert.sameValue(isFinite(obj), true, "use returned value - number");
+assert.sameValue(called, 1, "toPrimitive is called - number");
+
+called = 0;
+obj[Symbol.toPrimitive] = function() {
+ called += 1;
+ return "42";
+};
+assert.sameValue(isFinite(obj), true, "use returned value - string");
+assert.sameValue(called, 1, "toPrimitive is called - string");
+
+called = 0;
+obj[Symbol.toPrimitive] = function() {
+ called += 1;
+ return true;
+};
+assert.sameValue(isFinite(obj), true, "use returned value - boolean true");
+assert.sameValue(called, 1, "toPrimitive is called - boolean true");
+
+called = 0;
+obj[Symbol.toPrimitive] = function() {
+ called += 1;
+ return false;
+};
+assert.sameValue(isFinite(obj), true, "use returned value - boolean false");
+assert.sameValue(called, 1, "toPrimitive is called - boolean false");
+
+called = 0;
+obj[Symbol.toPrimitive] = function() {
+ called += 1;
+ return Infinity;
+};
+assert.sameValue(isFinite(obj), false, "use returned value - Infinity");
+assert.sameValue(called, 1, "toPrimitive is called - Infinity");
+
+called = 0;
+obj[Symbol.toPrimitive] = function() {
+ called += 1;
+ return -Infinity;
+};
+assert.sameValue(isFinite(obj), false, "use returned value - -Infinity");
+assert.sameValue(called, 1, "toPrimitive is called - -Infinity");
+
+reportCompare(0, 0);