mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 13:04:39 +02:00
Fix tests for toFixed and toExponential (#1080)
toExponential had a typo, and toFixed was against an earlier version of the specification proposal. The tests pass against a version of V8 which attempts to implement the new spec.
This commit is contained in:
parent
b07621ded1
commit
e2ee94f452
@ -13,7 +13,7 @@ info: >
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue((3).toExponential(0), "3e+0");
|
assert.sameValue((3).toExponential(0), "3e+0");
|
||||||
assert.throws(RangeError, () => (3).toExponential(0));
|
assert.throws(RangeError, () => (3).toExponential(-1));
|
||||||
|
|
||||||
assert.sameValue((3).toExponential(100), "3.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+0");
|
assert.sameValue((3).toExponential(100), "3.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+0");
|
||||||
assert.throws(RangeError, () => (3).toExponential(101));
|
assert.throws(RangeError, () => (3).toExponential(101));
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-number.prototype.tofixed
|
esid: sec-number.prototype.tofixed
|
||||||
description: Number.prototype.toFixed permits fractionDigits from -20 to 100
|
description: Number.prototype.toFixed permits fractionDigits from 0 to 100
|
||||||
info: >
|
info: >
|
||||||
Number.prototype.toFixed ( fractionDigits )
|
Number.prototype.toFixed ( fractionDigits )
|
||||||
|
|
||||||
...
|
...
|
||||||
3. If _f_ < -20 or _f_ > 100, throw a *RangeError* exception.
|
3. If _f_ < 0 or _f_ > 100, throw a *RangeError* exception.
|
||||||
...
|
...
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue((3).toFixed(-20), "0");
|
assert.sameValue((3).toFixed(-0), "3");
|
||||||
assert.throws(RangeError, () => (3).toFixed(-21));
|
assert.throws(RangeError, () => (3).toFixed(-1));
|
||||||
|
|
||||||
assert.sameValue((3).toFixed(100), "3.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
assert.sameValue((3).toFixed(100), "3.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
|
||||||
assert.throws(RangeError, () => (3).toFixed(101));
|
assert.throws(RangeError, () => (3).toFixed(101));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user