diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/isFinite/tonumber-operations.js')
-rw-r--r-- | js/src/tests/test262/built-ins/isFinite/tonumber-operations.js | 29 |
1 files changed, 29 insertions, 0 deletions
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); |