diff --git a/tests/es.js b/tests/es.js index 598ec1d61bd0..43576993923f 100644 --- a/tests/es.js +++ b/tests/es.js @@ -2745,33 +2745,33 @@ assert.name(toPrecision, 'toPrecision'); assert.arity(toPrecision, 1); assert.looksNative(toPrecision); - assert.same(0.00008.toPrecision(3), '0.0000800'); - assert.same(1.255.toPrecision(2), '1.3'); - assert.same(1843654265.0774949.toPrecision(13), '1843654265.077'); - assert.same(NaN.toPrecision(1), 'NaN'); - assert.same(123.456.toPrecision(), '123.456'); - assert.same(123.456.toPrecision(void 8), '123.456'); + assert.same(0.00008.toPrecision(3), '0.0000800', '0.00008.toPrecision(3)'); + assert.same(1.255.toPrecision(2), '1.3', '1.255.toPrecision(2)'); + assert.same(1843654265.0774949.toPrecision(13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); + assert.same(NaN.toPrecision(1), 'NaN', 'If x is NaN, return the String "NaN".'); + assert.same(123.456.toPrecision(), '123.456', 'If precision is undefined, return ! ToString(x).'); + assert.same(123.456.toPrecision(void 8), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(function(){ 0.9.toPrecision(0); - }, RangeError); + }, RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(function(){ 0.9.toPrecision(101); - }, RangeError); + }, RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(function(){ - return toPrecision.call({}, 1); - }, TypeError); + toPrecision.call({}, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call('123', 1); - }, TypeError); + toPrecision.call('123', 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call(false, 1); - }, TypeError); + toPrecision.call(false, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call(null, 1); - }, TypeError); + toPrecision.call(null, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call(void 8, 1); - }, TypeError); + toPrecision.call(void 8, 1); + }, TypeError, '? thisNumberValue(this value)'); }); }).call(this); diff --git a/tests/library.js b/tests/library.js index b95dbf880e15..264bb4d47ac2 100644 --- a/tests/library.js +++ b/tests/library.js @@ -2801,33 +2801,33 @@ var toPrecision; toPrecision = core.Number.toPrecision; assert.isFunction(toPrecision); - assert.same(toPrecision(0.00008, 3), '0.0000800'); - assert.same(toPrecision(1.255, 2), '1.3'); - assert.same(toPrecision(1843654265.0774949, 13), '1843654265.077'); - assert.same(toPrecision(NaN, 1), 'NaN'); - assert.same(toPrecision(123.456), '123.456'); - assert.same(toPrecision(123.456, void 8), '123.456'); + assert.same(toPrecision(0.00008, 3), '0.0000800', '0.00008.toPrecision(3)'); + assert.same(toPrecision(1.255, 2), '1.3', '1.255.toPrecision(2)'); + assert.same(toPrecision(1843654265.0774949, 13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); + assert.same(toPrecision(NaN, 1), 'NaN', 'If x is NaN, return the String "NaN".'); + assert.same(toPrecision(123.456), '123.456', 'If precision is undefined, return ! ToString(x).'); + assert.same(toPrecision(123.456, void 8), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(function(){ toPrecision(0.9, 0); - }, RangeError); + }, RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(function(){ toPrecision(0.9, 101); - }, RangeError); + }, RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(function(){ - return toPrecision({}, 1); - }, TypeError); + toPrecision({}, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision('123', 1); - }, TypeError); + toPrecision('123', 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision(false, 1); - }, TypeError); + toPrecision(false, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision(null, 1); - }, TypeError); + toPrecision(null, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision(void 8, 1); - }, TypeError); + toPrecision(void 8, 1); + }, TypeError, '? thisNumberValue(this value)'); }); }).call(this); diff --git a/tests/library/es6.number.to-precision.ls b/tests/library/es6.number.to-precision.ls index d63833fabb18..c9ab97072cf3 100644 --- a/tests/library/es6.number.to-precision.ls +++ b/tests/library/es6.number.to-precision.ls @@ -4,16 +4,16 @@ module \ES6 test 'Number#toPrecision' (assert)!-> {toPrecision} = core.Number assert.isFunction toPrecision - assert.same toPrecision(0.00008 3), '0.0000800' - assert.same toPrecision(1.255 2), '1.3' - assert.same toPrecision(1843654265.0774949 13), '1843654265.077' - assert.same toPrecision(NaN, 1), 'NaN' - assert.same toPrecision(123.456), '123.456' - assert.same toPrecision(123.456 void), '123.456' - assert.throws (!-> toPrecision 0.9 0), RangeError - assert.throws (!-> toPrecision 0.9 101), RangeError - assert.throws (-> toPrecision {}, 1), TypeError - assert.throws (-> toPrecision \123, 1), TypeError - assert.throws (-> toPrecision no, 1), TypeError - assert.throws (-> toPrecision null, 1), TypeError - assert.throws (-> toPrecision void, 1), TypeError \ No newline at end of file + assert.same toPrecision(0.00008 3), '0.0000800', '0.00008.toPrecision(3)' + assert.same toPrecision(1.255 2), '1.3', '1.255.toPrecision(2)' + assert.same toPrecision(1843654265.0774949 13), '1843654265.077', '1843654265.0774949.toPrecision(13)' + assert.same toPrecision(NaN, 1), 'NaN', 'If x is NaN, return the String "NaN".' + assert.same toPrecision(123.456), '123.456', 'If precision is undefined, return ! ToString(x).' + assert.same toPrecision(123.456 void), '123.456', 'If precision is undefined, return ! ToString(x).' + assert.throws (!-> toPrecision 0.9 0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.' + assert.throws (!-> toPrecision 0.9 101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.' + assert.throws (!-> toPrecision {}, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision \123, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision no, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision null, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision void, 1), TypeError, '? thisNumberValue(this value)' \ No newline at end of file diff --git a/tests/tests.js b/tests/tests.js index f5e0be5829ee..40eed695db62 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -3556,33 +3556,33 @@ assert.name(toPrecision, 'toPrecision'); assert.arity(toPrecision, 1); assert.looksNative(toPrecision); - assert.same(0.00008.toPrecision(3), '0.0000800'); - assert.same(1.255.toPrecision(2), '1.3'); - assert.same(1843654265.0774949.toPrecision(13), '1843654265.077'); - assert.same(NaN.toPrecision(1), 'NaN'); - assert.same(123.456.toPrecision(), '123.456'); - assert.same(123.456.toPrecision(void 8), '123.456'); + assert.same(0.00008.toPrecision(3), '0.0000800', '0.00008.toPrecision(3)'); + assert.same(1.255.toPrecision(2), '1.3', '1.255.toPrecision(2)'); + assert.same(1843654265.0774949.toPrecision(13), '1843654265.077', '1843654265.0774949.toPrecision(13)'); + assert.same(NaN.toPrecision(1), 'NaN', 'If x is NaN, return the String "NaN".'); + assert.same(123.456.toPrecision(), '123.456', 'If precision is undefined, return ! ToString(x).'); + assert.same(123.456.toPrecision(void 8), '123.456', 'If precision is undefined, return ! ToString(x).'); assert.throws(function(){ 0.9.toPrecision(0); - }, RangeError); + }, RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(function(){ 0.9.toPrecision(101); - }, RangeError); + }, RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'); assert.throws(function(){ - return toPrecision.call({}, 1); - }, TypeError); + toPrecision.call({}, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call('123', 1); - }, TypeError); + toPrecision.call('123', 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call(false, 1); - }, TypeError); + toPrecision.call(false, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call(null, 1); - }, TypeError); + toPrecision.call(null, 1); + }, TypeError, '? thisNumberValue(this value)'); assert.throws(function(){ - return toPrecision.call(void 8, 1); - }, TypeError); + toPrecision.call(void 8, 1); + }, TypeError, '? thisNumberValue(this value)'); }); }).call(this); diff --git a/tests/tests/es6.number.to-precision.ls b/tests/tests/es6.number.to-precision.ls index 1e13b3da4240..841372546c47 100644 --- a/tests/tests/es6.number.to-precision.ls +++ b/tests/tests/es6.number.to-precision.ls @@ -7,16 +7,16 @@ test 'Number#toPrecision' (assert)!-> assert.name toPrecision, \toPrecision assert.arity toPrecision, 1 assert.looksNative toPrecision - assert.same 0.00008.toPrecision(3), '0.0000800' - assert.same 1.255.toPrecision(2), '1.3' - assert.same 1843654265.0774949.toPrecision(13), '1843654265.077' - assert.same NaN.toPrecision(1), 'NaN' - assert.same 123.456.toPrecision!, '123.456' - assert.same 123.456.toPrecision(void), '123.456' - assert.throws (!-> 0.9.toPrecision 0), RangeError - assert.throws (!-> 0.9.toPrecision 101), RangeError - assert.throws (-> toPrecision.call {}, 1), TypeError - assert.throws (-> toPrecision.call \123, 1), TypeError - assert.throws (-> toPrecision.call no, 1), TypeError - assert.throws (-> toPrecision.call null, 1), TypeError - assert.throws (-> toPrecision.call void, 1), TypeError \ No newline at end of file + assert.same 0.00008.toPrecision(3), '0.0000800', '0.00008.toPrecision(3)' + assert.same 1.255.toPrecision(2), '1.3', '1.255.toPrecision(2)' + assert.same 1843654265.0774949.toPrecision(13), '1843654265.077', '1843654265.0774949.toPrecision(13)' + assert.same NaN.toPrecision(1), 'NaN', 'If x is NaN, return the String "NaN".' + assert.same 123.456.toPrecision!, '123.456', 'If precision is undefined, return ! ToString(x).' + assert.same 123.456.toPrecision(void), '123.456', 'If precision is undefined, return ! ToString(x).' + assert.throws (!-> 0.9.toPrecision 0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.' + assert.throws (!-> 0.9.toPrecision 101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.' + assert.throws (!-> toPrecision.call {}, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision.call \123, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision.call no, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision.call null, 1), TypeError, '? thisNumberValue(this value)' + assert.throws (!-> toPrecision.call void, 1), TypeError, '? thisNumberValue(this value)' \ No newline at end of file