built-ins/Number/*: make all indentation consistent (depth & character) (#1436)

This commit is contained in:
Rick Waldron 2018-02-15 15:11:50 -05:00 committed by Leo Balter
parent 4fd36e7f1d
commit 9a211b1c9f
140 changed files with 830 additions and 810 deletions

View File

@ -13,7 +13,14 @@ description: >
try
{
var __obj = {toString: function() {return "1"}, valueOf: function() {return new Object();}}
var __obj = {
toString: function() {
return "1"
},
valueOf: function() {
return new Object();
}
}
if (Number(__obj) !== 1) {
$ERROR('#1.1: var __obj = {toNumber: function() {return "1"}, valueOf: function() {return new Object();}}; Number(__obj) === 1. Actual: ' + (Number(__obj)));
}

View File

@ -13,7 +13,14 @@ description: >
try
{
var __obj = {valueOf:function(){return new Object;},toString: function() {return new Object();}}
var __obj = {
valueOf: function() {
return new Object;
},
toString: function() {
return new Object();
}
}
Number(__obj);
$ERROR('#1.1: var __obj = {valueOf:function(){return new Object;},toNumber: function() {return new Object();}}; Number(__obj) throw TypeError. Actual: ' + (Number(__obj)));
}

View File

@ -12,13 +12,27 @@ description: >
---*/
// CHECK#1
var object = {valueOf: function() {return "1"}, toString: function() {return 0}};
var object = {
valueOf: function() {
return "1"
},
toString: function() {
return 0
}
};
if (Number(object) !== 1) {
$ERROR('#1: var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; Number(object) === 1. Actual: ' + (Number(object)));
}
// CHECK#2
var object = {valueOf: function() {return {}}, toString: function() {return "0"}};
var object = {
valueOf: function() {
return {}
},
toString: function() {
return "0"
}
};
if (Number(object) !== 0) {
$ERROR('#2: var object = {valueOf: function() {return {}}, toString: function() {return "0"}}; Number(object) === 0. Actual: ' + (Number(object)));
}

View File

@ -70,18 +70,30 @@ assert.sameValue(Number(new Array(2,4,8,16,32)), NaN, "Number(new Array(2,4,8,16
// CHECK#11
var myobj1 = {
ToNumber : function(){return 12345;},
toString : function(){return "67890";},
valueOf : function(){return "[object MyObj]";}
ToNumber: function() {
return 12345;
},
toString: function() {
return "67890";
},
valueOf: function() {
return "[object MyObj]";
}
};
assert.sameValue(Number(myobj1), NaN, "Number(myobj1)");
// CHECK#12
var myobj2 = {
ToNumber : function(){return 12345;},
toString : function(){return "67890";},
valueOf : function(){return "9876543210";}
ToNumber: function() {
return 12345;
},
toString: function() {
return "67890";
},
valueOf: function() {
return "9876543210";
}
};
if (Number(myobj2) !== 9876543210) {
@ -91,16 +103,24 @@ if (Number(myobj2) !== 9876543210){
// CHECK#13
var myobj3 = {
ToNumber : function(){return 12345;},
toString : function(){return "[object MyObj]";}
ToNumber: function() {
return 12345;
},
toString: function() {
return "[object MyObj]";
}
};
assert.sameValue(Number(myobj3), NaN, "Number(myobj3)");
// CHECK#14
var myobj4 = {
ToNumber : function(){return 12345;},
toString : function(){return "67890";}
ToNumber: function() {
return 12345;
},
toString: function() {
return "67890";
}
};
if (Number(myobj4) !== 67890) {
@ -109,7 +129,9 @@ if (Number(myobj4) !== 67890){
// CHECK#15
var myobj5 = {
ToNumber : function(){return 12345;}
ToNumber: function() {
return 12345;
}
};
assert.sameValue(Number(myobj5), NaN, "Number(myobj5)");

View File

@ -17,5 +17,3 @@ assert.throws(RangeError, () => (3).toExponential(-1));
assert.sameValue((3).toExponential(100), "3.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+0");
assert.throws(RangeError, () => (3).toExponential(101));

View File

@ -18,4 +18,3 @@ assert.throws(RangeError, () => (3).toPrecision(-10));
assert.sameValue((3).toPrecision(100), "3.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
assert.throws(RangeError, () => (3).toPrecision(101));

View File

@ -12,61 +12,53 @@ try{
var n = Number.prototype.toString(1);
$ERROR('#1: Number.prototype.toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#2
try {
var n = (new Number()).toString(1);
$ERROR('#2: (new Number()).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#3
try {
var n = (new Number(0)).toString(1);
$ERROR('#3: (new Number(0)).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#4
try {
var n = (new Number(-1)).toString(1);
$ERROR('#4: (new Number(-1)).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#5
try {
var n = (new Number(1)).toString(1);
$ERROR('#5: (new Number(1)).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#6
try {
var n = (new Number(Number.NaN)).toString(1);
$ERROR('#6: (new Number(Number.NaN)).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#7
try {
var n = (new Number(Number.POSITIVE_INFINITY)).toString(1);
$ERROR('#7: (new Number(Number.POSITIVE_INFINITY)).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#8
try {
var n = (new Number(Number.NEGATIVE_INFINITY)).toString(1);
$ERROR('#8: (new Number(Number.NEGATIVE_INFINITY)).toString(1) should throw an Error');
}
catch(e){
}
catch (e) {}

View File

@ -12,61 +12,53 @@ try{
var n = Number.prototype.toString(37);
$ERROR('#1: Number.prototype.toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#2
try {
var n = (new Number()).toString(37);
$ERROR('#2: (new Number()).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#3
try {
var n = (new Number(0)).toString(37);
$ERROR('#3: (new Number(0)).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#4
try {
var n = (new Number(-1)).toString(37);
$ERROR('#4: (new Number(-1)).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#5
try {
var n = (new Number(1)).toString(37);
$ERROR('#5: (new Number(1)).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#6
try {
var n = (new Number(Number.NaN)).toString(37);
$ERROR('#6: (new Number(Number.NaN)).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#7
try {
var n = (new Number(Number.POSITIVE_INFINITY)).toString(37);
$ERROR('#7: (new Number(Number.POSITIVE_INFINITY)).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#8
try {
var n = (new Number(Number.NEGATIVE_INFINITY)).toString(37);
$ERROR('#8: (new Number(Number.NEGATIVE_INFINITY)).toString(37) should throw an Error');
}
catch(e){
}
catch (e) {}

View File

@ -12,61 +12,53 @@ try{
var n = Number.prototype.toString(null);
$ERROR('#1: Number.prototype.toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#2
try {
var n = (new Number()).toString(null);
$ERROR('#2: (new Number()).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#3
try {
var n = (new Number(0)).toString(null);
$ERROR('#3: (new Number(0)).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#4
try {
var n = (new Number(-1)).toString(null);
$ERROR('#4: (new Number(-1)).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#5
try {
var n = (new Number(1)).toString(null);
$ERROR('#5: (new Number(1)).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#6
try {
var n = (new Number(Number.NaN)).toString(null);
$ERROR('#6: (new Number(Number.NaN)).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#7
try {
var n = (new Number(Number.POSITIVE_INFINITY)).toString(null);
$ERROR('#7: (new Number(Number.POSITIVE_INFINITY)).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#8
try {
var n = (new Number(Number.NEGATIVE_INFINITY)).toString(null);
$ERROR('#8: (new Number(Number.NEGATIVE_INFINITY)).toString(null) should throw an Error');
}
catch(e){
}
catch (e) {}

View File

@ -12,61 +12,53 @@ try{
var n = Number.prototype.toString(0);
$ERROR('#1: Number.prototype.toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#2
try {
var n = (new Number()).toString(0);
$ERROR('#2: (new Number()).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#3
try {
var n = (new Number(0)).toString(0);
$ERROR('#3: (new Number(0)).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#4
try {
var n = (new Number(-1)).toString(0);
$ERROR('#4: (new Number(-1)).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#5
try {
var n = (new Number(1)).toString(0);
$ERROR('#5: (new Number(1)).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#6
try {
var n = (new Number(Number.NaN)).toString(0);
$ERROR('#6: (new Number(Number.NaN)).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#7
try {
var n = (new Number(Number.POSITIVE_INFINITY)).toString(0);
$ERROR('#7: (new Number(Number.POSITIVE_INFINITY)).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}
//CHECK#8
try {
var n = (new Number(Number.NEGATIVE_INFINITY)).toString(0);
$ERROR('#8: (new Number(Number.NEGATIVE_INFINITY)).toString(0) should throw an Error');
}
catch(e){
}
catch (e) {}

View File

@ -12,7 +12,9 @@ description: transferring to the other objects
//CHECK#1
try {
var s1 = {x: 1};
var s1 = {
x: 1
};
s1.toString = Number.prototype.toString;
var v1 = s1.toString();
$ERROR('#1: Number.prototype.toString on not a Number object should throw TypeError');
@ -25,7 +27,9 @@ catch(e){
//CHECK#2
try {
var s2 = {x: 1};
var s2 = {
x: 1
};
s2.myToString = Number.prototype.toString;
var v2 = s2.myToString();
$ERROR('#2: Number.prototype.toString on not a Number object should throw TypeError');

View File

@ -12,7 +12,9 @@ description: transferring to the other objects
//CHECK#1
try {
var s1 = {x: 1};
var s1 = {
x: 1
};
s1.valueOf = Number.prototype.valueOf;
var v1 = s1.valueOf();
$ERROR('#1: Number.prototype.valueOf on not a Number object should throw TypeError');
@ -25,7 +27,9 @@ catch(e){
//CHECK#2
try {
var s2 = {x: 1};
var s2 = {
x: 1
};
s2.myValueOf = Number.prototype.valueOf;
var v2 = s2.myValueOf();
$ERROR('#2: Number.prototype.valueOf on not a Number object should throw TypeError');

View File

@ -26,4 +26,3 @@ features: [numeric-separator-literal]
---*/
assert.sameValue(Number("1.0e+10_0"), NaN, "1.0e+10_0");

View File

@ -37,5 +37,3 @@ assert.sameValue(Number("6_6"), NaN, "6_6");
assert.sameValue(Number("7_7"), NaN, "7_7");
assert.sameValue(Number("8_8"), NaN, "8_8");
assert.sameValue(Number("9_9"), NaN, "9_9");