summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/test-common.js
diff options
context:
space:
mode:
authorAnonymous <anon@mous.org>2022-02-16 02:14:57 -0800
committerLinus Groh <mail@linusgroh.de>2022-02-16 11:18:41 +0000
commit1e0facb7ee71a8611052b4f87bd36a435d35050a (patch)
tree5d79ed00f44e5d4927a35c373dcc0514ba29bc95 /Userland/Libraries/LibJS/Tests/test-common.js
parent602190f66f7d74bba019b42870d1fc93e5a26a51 (diff)
downloadserenity-1e0facb7ee71a8611052b4f87bd36a435d35050a.zip
LibJS: Implement the Number::remainder AO using fmod
The ECMA verbiage for modulus is the mathematical definition implemented by fmod, so let's just use that rather than trying to reimplement all the edge cases.
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/test-common.js')
-rw-r--r--Userland/Libraries/LibJS/Tests/test-common.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js
index 1f9e3af979..b02c9cb287 100644
--- a/Userland/Libraries/LibJS/Tests/test-common.js
+++ b/Userland/Libraries/LibJS/Tests/test-common.js
@@ -53,6 +53,9 @@ class ExpectationError extends Error {
const valueToString = value => {
try {
+ if (value === 0 && 1 / value < 0) {
+ return "-0";
+ }
return String(value);
} catch {
// e.g for objects without a prototype, the above throws.