mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
57
tests/wpt/web-platform-tests/js/builtins/Math.maxmin.js
Normal file
57
tests/wpt/web-platform-tests/js/builtins/Math.maxmin.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
function testMathMaxMin(aFun) {
|
||||
var test_error = { name: "test" };
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
Math[aFun](NaN, {
|
||||
valueOf: function() {
|
||||
throw test_error;
|
||||
}
|
||||
});
|
||||
});
|
||||
}, "ToNumber should be called on all arguments: NaN.");
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
Math[aFun](-Infinity, {
|
||||
valueOf: function() {
|
||||
throw test_error;
|
||||
}
|
||||
});
|
||||
});
|
||||
}, "ToNumber should be called on all arguments: -Infinity.");
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
Math[aFun](Infinity, {
|
||||
valueOf: function() {
|
||||
throw test_error;
|
||||
}
|
||||
});
|
||||
});
|
||||
}, "ToNumber should be called on all arguments: Infinity.");
|
||||
test(function() {
|
||||
assert_throws(test_error, function() {
|
||||
Math[aFun]({
|
||||
valueOf: function() {
|
||||
throw test_error;
|
||||
}
|
||||
},
|
||||
{
|
||||
valueOf: function() {
|
||||
throw 7;
|
||||
}
|
||||
});
|
||||
});
|
||||
}, "ToNumber should be called left to right.");
|
||||
test(function() {
|
||||
assert_equals(Math[aFun]("1"), 1);
|
||||
}, "Should return a number.");
|
||||
test(function() {
|
||||
var expected = {
|
||||
"max": 0,
|
||||
"min": -0
|
||||
}
|
||||
assert_equals(Math[aFun](0, -0), expected[aFun]);
|
||||
assert_equals(Math[aFun](-0, 0), expected[aFun]);
|
||||
assert_equals(Math[aFun](0, 0), 0);
|
||||
assert_equals(Math[aFun](-0, -0), -0);
|
||||
}, "Should handle negative zero correctly.");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue