Skip to content
Snippets Groups Projects
Commit 0bf08dff authored by Rick Waldron's avatar Rick Waldron Committed by Leo Balter
Browse files

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

parent b59d956b
No related branches found
No related tags found
No related merge requests found
Showing
with 109 additions and 71 deletions
......@@ -18,7 +18,10 @@ includes: [compareArray.js]
var mapSet = Map.prototype.set;
var counter = 0;
var iterable = [["foo", 1], ["bar", 2]];
var iterable = [
["foo", 1],
["bar", 2]
];
var results = [];
var _this = [];
......
......@@ -20,14 +20,19 @@ var iterable = {};
iterable[Symbol.iterator] = function() {
return {
next: function() {
return { value: [], done: false };
return {
value: [],
done: false
};
},
return: function() {
count += 1;
}
};
};
Map.prototype.set = function() { throw new Test262Error(); }
Map.prototype.set = function() {
throw new Test262Error();
}
assert.throws(Test262Error, function() {
new Map(iterable);
......
......@@ -27,7 +27,10 @@ var iterable = {};
iterable[Symbol.iterator] = function() {
return {
next: function() {
return { value: nextItem, done: false };
return {
value: nextItem,
done: false
};
},
return: function() {
count += 1;
......
......@@ -44,5 +44,7 @@ assert.throws(TypeError, function() {
});
assert.throws(TypeError, function() {
new Map([['a', 1], 2]);
new Map([
['a', 1], 2
]);
});
......@@ -23,5 +23,8 @@ info: |
Map.prototype.set = null;
assert.throws(TypeError, function() {
new Map([[1,1], [2,2]]);
new Map([
[1, 1],
[2, 2]
]);
});
......@@ -17,8 +17,8 @@ info: |
---*/
var m = new Map([
[ "attr", 1 ],
[ "foo", 2 ]
["attr", 1],
["foo", 2]
]);
assert.sameValue(m.size, 2, 'The value of `m.size` is `2`');
......
......@@ -25,7 +25,10 @@ assert.sameValue(
"`Object.getPrototypeOf(m1)` returns `Map.prototype`"
);
var m2 = new Map([[1, 1], [2, 2]]);
var m2 = new Map([
[1, 1],
[2, 2]
]);
assert.sameValue(
Object.getPrototypeOf(m2),
......
......@@ -17,11 +17,14 @@ info: |
features: [Symbol]
---*/
var m1 = new Map([['foo', 'bar'], [1, 1]]);
var m1 = new Map([
['foo', 'bar'],
[1, 1]
]);
var m2 = new Map();
var m3 = new Map();
m2.set('foo', 'bar');
m2.set(1,1);
m2.set(1, 1);
m2.set(Symbol('a'), Symbol('a'));
m1.clear();
......
......@@ -11,9 +11,9 @@ includes: [propertyHelper.js]
---*/
assert.sameValue(
typeof Map.prototype.clear,
'function',
'typeof Map.prototype.clear is "function"'
typeof Map.prototype.clear,
'function',
'typeof Map.prototype.clear is "function"'
);
verifyNotEnumerable(Map.prototype, 'clear');
......
......@@ -20,7 +20,11 @@ info: |
6. Return undefined.
---*/
var m = new Map([[1,1], [2,2], [3,3]]);
var m = new Map([
[1, 1],
[2, 2],
[3, 3]
]);
var e = m.entries();
e.next();
......
......@@ -16,7 +16,10 @@ info: |
6. Return undefined.
---*/
var m1 = new Map([['foo', 'bar'], [1, 1]]);
var m1 = new Map([
['foo', 'bar'],
[1, 1]
]);
assert.sameValue(m1.clear(), undefined, 'clears a map and returns undefined');
assert.sameValue(m1.clear(), undefined, 'returns undefined on an empty map');
......@@ -11,9 +11,9 @@ includes: [propertyHelper.js]
---*/
assert.sameValue(
typeof Map.prototype.delete,
'function',
'typeof Map.prototype.delete is "function"'
typeof Map.prototype.delete,
'function',
'typeof Map.prototype.delete is "function"'
);
verifyNotEnumerable(Map.prototype, 'delete');
......
......@@ -16,7 +16,11 @@ info: |
...
---*/
var m = new Map([['a',1], ['b', 2], ['c', 3]]);
var m = new Map([
['a', 1],
['b', 2],
['c', 3]
]);
var e = m.entries();
e.next();
......
......@@ -15,7 +15,10 @@ info: |
6. Return false.
---*/
var m = new Map([['a',1], ['b', 2]]);
var m = new Map([
['a', 1],
['b', 2]
]);
assert.sameValue(m.delete('not-in-the-map'), false);
......
......@@ -16,7 +16,10 @@ info: |
...
---*/
var m = new Map([['a',1], ['b', 2]]);
var m = new Map([
['a', 1],
['b', 2]
]);
var result = m.delete('a');
......
......@@ -11,5 +11,5 @@ description: Checking if Math.abs(-Infinity) equals to +Infinity
var x = -Infinity;
if (Math.abs(x) !== +Infinity)
{
$ERROR("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'");
$ERROR("#1: 'var x=-Infinity; Math.abs(x) !== +Infinity'");
}
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Math.acosh with special values
es6id: 20.2.2.3
info: |
Math.acosh ( x )
- If x is NaN, the result is NaN.
- If x is less than 1, the result is NaN.
---*/
assert.sameValue(Math.acosh(NaN), NaN, "NaN");
assert.sameValue(Math.acosh(0.999999), NaN, "0.999999");
assert.sameValue(Math.acosh(0), NaN, "0");
assert.sameValue(Math.acosh(-1), NaN, "-1");
assert.sameValue(Math.acosh(-Infinity), NaN, "-Infinity");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Math.acosh with special values
es6id: 20.2.2.3
info: |
Math.acosh ( x )
- If x is NaN, the result is NaN.
- If x is less than 1, the result is NaN.
---*/
assert.sameValue(Math.acosh(NaN), NaN, "NaN");
assert.sameValue(Math.acosh(0.999999), NaN, "0.999999");
assert.sameValue(Math.acosh(0), NaN, "0");
assert.sameValue(Math.acosh(-1), NaN, "-1");
assert.sameValue(Math.acosh(-Infinity), NaN, "-Infinity");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Math.asinh with special values
es6id: 20.2.2.5
---*/
assert.sameValue(Math.asinh(NaN), Number.NaN,
"Math.asinh produces incorrect output for NaN");
assert.sameValue(Math.asinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
"Math.asinh should produce negative infinity for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.asinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.asinh should produce positive infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1 / Math.asinh(-0), Number.NEGATIVE_INFINITY,
"Math.asinh should produce -0 for -0");
assert.sameValue(1 / Math.asinh(0), Number.POSITIVE_INFINITY,
"Math.asinh should produce +0 for +0");
// Copyright 2015 Microsoft Corporation. All rights reserved.
// This code is governed by the license found in the LICENSE file.
/*---
description: Math.asinh with special values
es6id: 20.2.2.5
---*/
assert.sameValue(Math.asinh(NaN), Number.NaN,
"Math.asinh produces incorrect output for NaN");
assert.sameValue(Math.asinh(Number.NEGATIVE_INFINITY), Number.NEGATIVE_INFINITY,
"Math.asinh should produce negative infinity for Number.NEGATIVE_INFINITY");
assert.sameValue(Math.asinh(Number.POSITIVE_INFINITY), Number.POSITIVE_INFINITY,
"Math.asinh should produce positive infinity for Number.POSITIVE_INFINITY");
assert.sameValue(1 / Math.asinh(-0), Number.NEGATIVE_INFINITY,
"Math.asinh should produce -0 for -0");
assert.sameValue(1 / Math.asinh(0), Number.POSITIVE_INFINITY,
"Math.asinh should produce +0 for +0");
......@@ -24,14 +24,14 @@ var valnum = 7;
var args = new Array();
for (var i = 0; i < 2; i++)
{
args[i] = NaN;
for (var j = 0; j < valnum; j++)
{
args[1-i] = vals[j];
assert.sameValue(
Math.atan2(args[0], args[1]),
NaN,
"(" + args[0] + ", " + args[1] + ")"
);
}
args[i] = NaN;
for (var j = 0; j < valnum; j++)
{
args[1 - i] = vals[j];
assert.sameValue(
Math.atan2(args[0], args[1]),
NaN,
"(" + args[0] + ", " + args[1] + ")"
);
}
}
......@@ -20,8 +20,7 @@ var ynum = 3;
for (var i = 0; i < ynum; i++)
{
assert.sameValue(
Math.atan2(y[i], x),
-0,
Math.atan2(y[i], x), -0,
"(" + y[i] + ", Infinity)"
);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment