mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
LibJS: Add Object.prototype.toLocaleString()
This commit is contained in:
parent
9755f8d297
commit
70d2add22f
3 changed files with 42 additions and 0 deletions
32
Libraries/LibJS/Tests/Object.prototype.toLocaleString.js
Normal file
32
Libraries/LibJS/Tests/Object.prototype.toLocaleString.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(Object.prototype.toLocaleString.length === 0);
|
||||
|
||||
var o;
|
||||
|
||||
o = {};
|
||||
assert(o.toString() === o.toLocaleString());
|
||||
|
||||
o = { toString: () => 42 };
|
||||
assert(o.toString() === 42);
|
||||
|
||||
o = { toString: () => { throw Error(); } };
|
||||
assertThrowsError(() => {
|
||||
o.toLocaleString();
|
||||
}, {
|
||||
error: Error
|
||||
});
|
||||
|
||||
o = { toString: "foo" };
|
||||
assertThrowsError(() => {
|
||||
o.toLocaleString();
|
||||
}, {
|
||||
error: TypeError,
|
||||
message: "foo is not a function"
|
||||
});
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue