Przeglądaj źródła

LibJS: Indent tests with 4 spaces instead of 2

Matthew Olsson 5 lat temu
rodzic
commit
1ef573eb30
100 zmienionych plików z 2519 dodań i 2510 usunięć
  1. 11 11
      Libraries/LibJS/Tests/.prettierrc
  2. 4 4
      Libraries/LibJS/Tests/add-values-to-primitive.js
  3. 7 7
      Libraries/LibJS/Tests/automatic-semicolon-insertion.js
  4. 20 20
      Libraries/LibJS/Tests/builtins/Array/Array.isArray.js
  5. 50 50
      Libraries/LibJS/Tests/builtins/Array/Array.js
  6. 45 45
      Libraries/LibJS/Tests/builtins/Array/Array.of.js
  7. 156 151
      Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js
  8. 24 24
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.concat.js
  9. 44 44
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js
  10. 15 15
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.fill.js
  11. 62 62
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js
  12. 49 49
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js
  13. 49 49
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js
  14. 56 56
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js
  15. 14 14
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.includes.js
  16. 21 21
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.indexOf.js
  17. 12 12
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.join.js
  18. 18 18
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.lastIndexOf.js
  19. 58 58
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js
  20. 13 13
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.pop.js
  21. 21 21
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.push.js
  22. 127 127
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js
  23. 129 129
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js
  24. 18 18
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.reverse.js
  25. 13 13
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.shift.js
  26. 48 48
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js
  27. 28 28
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js
  28. 72 72
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js
  29. 16 16
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js
  30. 13 13
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.toString.js
  31. 21 21
      Libraries/LibJS/Tests/builtins/Array/Array.prototype.unshift.js
  32. 58 58
      Libraries/LibJS/Tests/builtins/Array/array-basic.js
  33. 44 44
      Libraries/LibJS/Tests/builtins/Array/array-length-setter.js
  34. 17 17
      Libraries/LibJS/Tests/builtins/Array/array-shrink-during-find-crash.js
  35. 37 37
      Libraries/LibJS/Tests/builtins/Array/array-spread.js
  36. 53 53
      Libraries/LibJS/Tests/builtins/BigInt/BigInt.js
  37. 5 5
      Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js
  38. 5 5
      Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toString.js
  39. 7 7
      Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.valueOf.js
  40. 66 66
      Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js
  41. 24 24
      Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js
  42. 22 22
      Libraries/LibJS/Tests/builtins/Boolean/Boolean.js
  43. 3 3
      Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js
  44. 10 10
      Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.toString.js
  45. 9 9
      Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.valueOf.js
  46. 3 3
      Libraries/LibJS/Tests/builtins/Date/Date.js
  47. 8 8
      Libraries/LibJS/Tests/builtins/Date/Date.now.js
  48. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDate.js
  49. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDay.js
  50. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getFullYear.js
  51. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getHours.js
  52. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMilliseconds.js
  53. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMinutes.js
  54. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMonth.js
  55. 5 5
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getSeconds.js
  56. 4 4
      Libraries/LibJS/Tests/builtins/Date/Date.prototype.getTime.js
  57. 10 10
      Libraries/LibJS/Tests/builtins/Error/Error.js
  58. 6 6
      Libraries/LibJS/Tests/builtins/Error/Error.prototype.name.js
  59. 5 5
      Libraries/LibJS/Tests/builtins/Error/Error.prototype.toString.js
  60. 43 41
      Libraries/LibJS/Tests/builtins/Function/Function.js
  61. 49 49
      Libraries/LibJS/Tests/builtins/Function/Function.prototype.apply.js
  62. 132 132
      Libraries/LibJS/Tests/builtins/Function/Function.prototype.bind.js
  63. 48 48
      Libraries/LibJS/Tests/builtins/Function/Function.prototype.call.js
  64. 15 15
      Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js
  65. 20 20
      Libraries/LibJS/Tests/builtins/Infinity/Infinity.js
  66. 7 5
      Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js
  67. 30 30
      Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js
  68. 22 22
      Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js
  69. 8 8
      Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-proxy.js
  70. 31 31
      Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js
  71. 19 19
      Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-space.js
  72. 59 59
      Libraries/LibJS/Tests/builtins/JSON/JSON.stringify.js
  73. 8 8
      Libraries/LibJS/Tests/builtins/Math/Math-constants.js
  74. 11 11
      Libraries/LibJS/Tests/builtins/Math/Math.abs.js
  75. 6 6
      Libraries/LibJS/Tests/builtins/Math/Math.acosh.js
  76. 3 3
      Libraries/LibJS/Tests/builtins/Math/Math.asinh.js
  77. 7 7
      Libraries/LibJS/Tests/builtins/Math/Math.atanh.js
  78. 9 9
      Libraries/LibJS/Tests/builtins/Math/Math.cbrt.js
  79. 9 9
      Libraries/LibJS/Tests/builtins/Math/Math.ceil.js
  80. 40 40
      Libraries/LibJS/Tests/builtins/Math/Math.clz32.js
  81. 11 11
      Libraries/LibJS/Tests/builtins/Math/Math.cos.js
  82. 9 9
      Libraries/LibJS/Tests/builtins/Math/Math.exp.js
  83. 9 9
      Libraries/LibJS/Tests/builtins/Math/Math.expm1.js
  84. 9 9
      Libraries/LibJS/Tests/builtins/Math/Math.floor.js
  85. 5 5
      Libraries/LibJS/Tests/builtins/Math/Math.log1p.js
  86. 7 7
      Libraries/LibJS/Tests/builtins/Math/Math.max.js
  87. 6 6
      Libraries/LibJS/Tests/builtins/Math/Math.min.js
  88. 22 22
      Libraries/LibJS/Tests/builtins/Math/Math.pow.js
  89. 25 25
      Libraries/LibJS/Tests/builtins/Math/Math.sign.js
  90. 12 12
      Libraries/LibJS/Tests/builtins/Math/Math.sin.js
  91. 2 2
      Libraries/LibJS/Tests/builtins/Math/Math.sqrt.js
  92. 11 11
      Libraries/LibJS/Tests/builtins/Math/Math.tan.js
  93. 8 8
      Libraries/LibJS/Tests/builtins/Math/Math.trunc.js
  94. 10 10
      Libraries/LibJS/Tests/builtins/NaN/NaN.js
  95. 9 9
      Libraries/LibJS/Tests/builtins/Number/Number-constants.js
  96. 20 20
      Libraries/LibJS/Tests/builtins/Number/Number.isFinite.js
  97. 28 28
      Libraries/LibJS/Tests/builtins/Number/Number.isInteger.js
  98. 21 21
      Libraries/LibJS/Tests/builtins/Number/Number.isNaN.js
  99. 20 20
      Libraries/LibJS/Tests/builtins/Number/Number.isSafeInteger.js
  100. 29 29
      Libraries/LibJS/Tests/builtins/Number/Number.js

+ 11 - 11
Libraries/LibJS/Tests/.prettierrc

@@ -1,13 +1,13 @@
 {
-  "arrowParens": "avoid",
-  "bracketSpacing": true,
-  "endOfLine": "lf",
-  "insertPragma": false,
-  "printWidth": 100,
-  "quoteProps": "as-needed",
-  "semi": true,
-  "singleQuote": false,
-  "tabWidth": 2,
-  "trailingComma": "es5",
-  "useTabs": false
+    "arrowParens": "avoid",
+    "bracketSpacing": true,
+    "endOfLine": "lf",
+    "insertPragma": false,
+    "printWidth": 100,
+    "quoteProps": "as-needed",
+    "semi": true,
+    "singleQuote": false,
+    "tabWidth": 4,
+    "trailingComma": "es5",
+    "useTabs": false
 }

+ 4 - 4
Libraries/LibJS/Tests/add-values-to-primitive.js

@@ -1,6 +1,6 @@
 test("adding objects", () => {
-  expect([] + []).toBe("");
-  expect([] + {}).toBe("[object Object]");
-  expect({} + {}).toBe("[object Object][object Object]");
-  expect({} + []).toBe("[object Object]");
+    expect([] + []).toBe("");
+    expect([] + {}).toBe("[object Object]");
+    expect({} + {}).toBe("[object Object][object Object]");
+    expect({} + []).toBe("[object Object]");
 });

+ 7 - 7
Libraries/LibJS/Tests/automatic-semicolon-insertion.js

@@ -1,5 +1,5 @@
 test("Issue #1829, if-else without braces or semicolons", () => {
-  const source = `if (1)
+    const source = `if (1)
     return 1;
 else
     return 0;
@@ -14,11 +14,11 @@ if (1)
 else
     return 0;`;
 
-  expect(source).toEval();
+    expect(source).toEval();
 });
 
 test("break/continue, variable declaration, do-while, and return asi", () => {
-  const source = `function foo() {
+    const source = `function foo() {
     label:
     for (var i = 0; i < 4; i++) {
         break // semicolon inserted here
@@ -39,11 +39,11 @@ var curly/* semicolon inserted here */}
 
 return foo();`;
 
-  expect(source).toEvalTo(undefined);
+    expect(source).toEvalTo(undefined);
 });
 
 test("more break and continue asi", () => {
-  const source = `let counter = 0;
+    const source = `let counter = 0;
 let outer;
 
 outer:
@@ -57,9 +57,9 @@ for (let i = 0; i < 5; ++i) {
 
 return counter;`;
 
-  expect(source).toEvalTo(5);
+    expect(source).toEvalTo(5);
 });
 
 test("eof with no semicolon", () => {
-  expect("var eof").toEval();
+    expect("var eof").toEval();
 });

+ 20 - 20
Libraries/LibJS/Tests/builtins/Array/Array.isArray.js

@@ -1,28 +1,28 @@
 load("test-common.js");
 
 try {
-  assert(Array.isArray.length === 1);
+    assert(Array.isArray.length === 1);
 
-  assert(Array.isArray() === false);
-  assert(Array.isArray("1") === false);
-  assert(Array.isArray("foo") === false);
-  assert(Array.isArray(1) === false);
-  assert(Array.isArray(1, 2, 3) === false);
-  assert(Array.isArray(undefined) === false);
-  assert(Array.isArray(null) === false);
-  assert(Array.isArray(Infinity) === false);
-  assert(Array.isArray({}) === false);
+    assert(Array.isArray() === false);
+    assert(Array.isArray("1") === false);
+    assert(Array.isArray("foo") === false);
+    assert(Array.isArray(1) === false);
+    assert(Array.isArray(1, 2, 3) === false);
+    assert(Array.isArray(undefined) === false);
+    assert(Array.isArray(null) === false);
+    assert(Array.isArray(Infinity) === false);
+    assert(Array.isArray({}) === false);
 
-  assert(Array.isArray([]) === true);
-  assert(Array.isArray([1]) === true);
-  assert(Array.isArray([1, 2, 3]) === true);
-  assert(Array.isArray(new Array()) === true);
-  assert(Array.isArray(new Array(10)) === true);
-  assert(Array.isArray(new Array("a", "b", "c")) === true);
-  // FIXME: Array.prototype is supposed to be an array!
-  // assert(Array.isArray(Array.prototype) === true);
+    assert(Array.isArray([]) === true);
+    assert(Array.isArray([1]) === true);
+    assert(Array.isArray([1, 2, 3]) === true);
+    assert(Array.isArray(new Array()) === true);
+    assert(Array.isArray(new Array(10)) === true);
+    assert(Array.isArray(new Array("a", "b", "c")) === true);
+    // FIXME: Array.prototype is supposed to be an array!
+    // assert(Array.isArray(Array.prototype) === true);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 50 - 50
Libraries/LibJS/Tests/builtins/Array/Array.js

@@ -1,55 +1,55 @@
 load("test-common.js");
 
 try {
-  assert(Array.length === 1);
-  assert(Array.name === "Array");
-  assert(Array.prototype.length === 0);
-
-  assert(typeof Array() === "object");
-  assert(typeof new Array() === "object");
-
-  var a;
-
-  a = new Array(5);
-  assert(a.length === 5);
-
-  a = new Array("5");
-  assert(a.length === 1);
-  assert(a[0] === "5");
-
-  a = new Array(1, 2, 3);
-  assert(a.length === 3);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-
-  a = new Array([1, 2, 3]);
-  assert(a.length === 1);
-  assert(a[0][0] === 1);
-  assert(a[0][1] === 2);
-  assert(a[0][2] === 3);
-
-  a = new Array(1, 2, 3);
-  Object.defineProperty(a, 3, {
-    get() {
-      return 10;
-    },
-  });
-  assert(a.toString() === "1,2,3,10");
-
-  [-1, -100, -0.1, 0.1, 1.23, Infinity, -Infinity, NaN].forEach(value => {
-    assertThrowsError(
-      () => {
-        new Array(value);
-      },
-      {
-        error: TypeError,
-        message: "Invalid array length",
-      }
-    );
-  });
-
-  console.log("PASS");
+    assert(Array.length === 1);
+    assert(Array.name === "Array");
+    assert(Array.prototype.length === 0);
+
+    assert(typeof Array() === "object");
+    assert(typeof new Array() === "object");
+
+    var a;
+
+    a = new Array(5);
+    assert(a.length === 5);
+
+    a = new Array("5");
+    assert(a.length === 1);
+    assert(a[0] === "5");
+
+    a = new Array(1, 2, 3);
+    assert(a.length === 3);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+
+    a = new Array([1, 2, 3]);
+    assert(a.length === 1);
+    assert(a[0][0] === 1);
+    assert(a[0][1] === 2);
+    assert(a[0][2] === 3);
+
+    a = new Array(1, 2, 3);
+    Object.defineProperty(a, 3, {
+        get() {
+            return 10;
+        },
+    });
+    assert(a.toString() === "1,2,3,10");
+
+    [-1, -100, -0.1, 0.1, 1.23, Infinity, -Infinity, NaN].forEach(value => {
+        assertThrowsError(
+            () => {
+                new Array(value);
+            },
+            {
+                error: TypeError,
+                message: "Invalid array length",
+            }
+        );
+    });
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 45 - 45
Libraries/LibJS/Tests/builtins/Array/Array.of.js

@@ -1,50 +1,50 @@
 load("test-common.js");
 
 try {
-  assert(Array.of.length === 0);
-
-  assert(typeof Array.of() === "object");
-
-  var a;
-
-  a = Array.of(5);
-  assert(a.length === 1);
-  assert(a[0] === 5);
-
-  a = Array.of("5");
-  assert(a.length === 1);
-  assert(a[0] === "5");
-
-  a = Array.of(Infinity);
-  assert(a.length === 1);
-  assert(a[0] === Infinity);
-
-  a = Array.of(1, 2, 3);
-  assert(a.length === 3);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-
-  a = Array.of([1, 2, 3]);
-  assert(a.length === 1);
-  assert(a[0][0] === 1);
-  assert(a[0][1] === 2);
-  assert(a[0][2] === 3);
-
-  let t = [1, 2, 3];
-  Object.defineProperty(t, 3, {
-    get() {
-      return 4;
-    },
-  });
-  a = Array.of(...t);
-  assert(a.length === 4);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-  assert(a[3] === 4);
-
-  console.log("PASS");
+    assert(Array.of.length === 0);
+
+    assert(typeof Array.of() === "object");
+
+    var a;
+
+    a = Array.of(5);
+    assert(a.length === 1);
+    assert(a[0] === 5);
+
+    a = Array.of("5");
+    assert(a.length === 1);
+    assert(a[0] === "5");
+
+    a = Array.of(Infinity);
+    assert(a.length === 1);
+    assert(a[0] === Infinity);
+
+    a = Array.of(1, 2, 3);
+    assert(a.length === 3);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+
+    a = Array.of([1, 2, 3]);
+    assert(a.length === 1);
+    assert(a[0][0] === 1);
+    assert(a[0][1] === 2);
+    assert(a[0][2] === 3);
+
+    let t = [1, 2, 3];
+    Object.defineProperty(t, 3, {
+        get() {
+            return 4;
+        },
+    });
+    a = Array.of(...t);
+    assert(a.length === 4);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+    assert(a[3] === 4);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 156 - 151
Libraries/LibJS/Tests/builtins/Array/Array.prototype-generic-functions.js

@@ -1,159 +1,164 @@
 load("test-common.js");
 
 try {
-  [undefined, "foo", -42, 0].forEach(length => {
-    const o = { length };
-
-    assert(Array.prototype.push.call(o, "foo") === 1);
-    assert(o.length === 1);
-    assert(o[0] === "foo");
-    assert(Array.prototype.push.call(o, "bar", "baz") === 3);
-    assert(o.length === 3);
-    assert(o[0] === "foo");
-    assert(o[1] === "bar");
-    assert(o[2] === "baz");
-
-    assert(Array.prototype.pop.call(o) === "baz");
-    assert(o.length === 2);
-    assert(Array.prototype.pop.call(o) === "bar");
-    assert(o.length === 1);
-    assert(Array.prototype.pop.call(o) === "foo");
-    assert(o.length === 0);
-    assert(Array.prototype.pop.call(o) === undefined);
-    assert(o.length === 0);
-
-    o.length = length;
-    assert(Array.prototype.pop.call(o) === undefined);
-    assert(o.length === 0);
-  });
-
-  {
-    const o = { length: 3, 0: "hello", 2: "serenity" };
-    const removed = Array.prototype.splice.call(o, 0, 2, "hello", "friends");
-    assert(o.length === 3);
-    assert(o[0] === "hello");
-    assert(o[1] === "friends");
-    assert(o[2] === "serenity");
-    assert(removed.length === 2);
-    assert(removed[0] === "hello");
-    assert(removed[1] === undefined);
-  }
-
-  {
-    assert(Array.prototype.join.call({}) === "");
-    assert(Array.prototype.join.call({ length: "foo" }) === "");
-    assert(Array.prototype.join.call({ length: 3 }) === ",,");
-    assert(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar" }) === "foo,bar");
-    assert(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar", 2: "baz" }) === "foo,bar");
-    assert(Array.prototype.join.call({ length: 3, 1: "bar" }, "~") === "~bar~");
-    assert(
-      Array.prototype.join.call({ length: 3, 0: "foo", 1: "bar", 2: "baz" }, "~") === "foo~bar~baz"
-    );
-  }
-
-  {
-    assert(Array.prototype.toString.call({}) === "[object Object]");
-    assert(Array.prototype.toString.call({ join: "foo" }) === "[object Object]");
-    assert(Array.prototype.toString.call({ join: () => "foo" }) === "foo");
-  }
-
-  {
-    assert(Array.prototype.indexOf.call({}) === -1);
-    assert(Array.prototype.indexOf.call({ 0: undefined }) === -1);
-    assert(Array.prototype.indexOf.call({ length: 1, 0: undefined }) === 0);
-    assert(Array.prototype.indexOf.call({ length: 1, 2: "foo" }, "foo") === -1);
-    assert(Array.prototype.indexOf.call({ length: 5, 2: "foo" }, "foo") === 2);
-    assert(Array.prototype.indexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", 3) === 4);
-  }
-
-  {
-    assert(Array.prototype.lastIndexOf.call({}) === -1);
-    assert(Array.prototype.lastIndexOf.call({ 0: undefined }) === -1);
-    assert(Array.prototype.lastIndexOf.call({ length: 1, 0: undefined }) === 0);
-    assert(Array.prototype.lastIndexOf.call({ length: 1, 2: "foo" }, "foo") === -1);
-    assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo" }, "foo") === 2);
-    assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo") === 4);
-    assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2) === 2);
-  }
-
-  {
-    assert(Array.prototype.includes.call({}) === false);
-    assert(Array.prototype.includes.call({ 0: undefined }) === false);
-    assert(Array.prototype.includes.call({ length: 1, 0: undefined }) === true);
-    assert(Array.prototype.includes.call({ length: 1, 2: "foo" }, "foo") === false);
-    assert(Array.prototype.includes.call({ length: 5, 2: "foo" }, "foo") === true);
-  }
-
-  const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" };
-
-  {
-    assertVisitsAll(
-      visit => {
-        Array.prototype.every.call(o, function (value) {
-          visit(value);
-          return true;
-        });
-      },
-      ["foo", "bar", "baz"]
-    );
-  }
-
-  ["find", "findIndex"].forEach(name => {
-    assertVisitsAll(
-      visit => {
-        Array.prototype[name].call(o, function (value) {
-          visit(value);
-          return false;
-        });
-      },
-      ["foo", "bar", undefined, "baz", undefined]
-    );
-  });
-
-  ["filter", "forEach", "map", "some"].forEach(name => {
-    assertVisitsAll(
-      visit => {
-        Array.prototype[name].call(o, function (value) {
-          visit(value);
-          return false;
-        });
-      },
-      ["foo", "bar", "baz"]
-    );
-  });
-  {
-    assertVisitsAll(
-      visit => {
-        Array.prototype.reduce.call(
-          o,
-          function (_, value) {
-            visit(value);
-            return false;
-          },
-          "initial"
+    [undefined, "foo", -42, 0].forEach(length => {
+        const o = { length };
+
+        assert(Array.prototype.push.call(o, "foo") === 1);
+        assert(o.length === 1);
+        assert(o[0] === "foo");
+        assert(Array.prototype.push.call(o, "bar", "baz") === 3);
+        assert(o.length === 3);
+        assert(o[0] === "foo");
+        assert(o[1] === "bar");
+        assert(o[2] === "baz");
+
+        assert(Array.prototype.pop.call(o) === "baz");
+        assert(o.length === 2);
+        assert(Array.prototype.pop.call(o) === "bar");
+        assert(o.length === 1);
+        assert(Array.prototype.pop.call(o) === "foo");
+        assert(o.length === 0);
+        assert(Array.prototype.pop.call(o) === undefined);
+        assert(o.length === 0);
+
+        o.length = length;
+        assert(Array.prototype.pop.call(o) === undefined);
+        assert(o.length === 0);
+    });
+
+    {
+        const o = { length: 3, 0: "hello", 2: "serenity" };
+        const removed = Array.prototype.splice.call(o, 0, 2, "hello", "friends");
+        assert(o.length === 3);
+        assert(o[0] === "hello");
+        assert(o[1] === "friends");
+        assert(o[2] === "serenity");
+        assert(removed.length === 2);
+        assert(removed[0] === "hello");
+        assert(removed[1] === undefined);
+    }
+
+    {
+        assert(Array.prototype.join.call({}) === "");
+        assert(Array.prototype.join.call({ length: "foo" }) === "");
+        assert(Array.prototype.join.call({ length: 3 }) === ",,");
+        assert(Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar" }) === "foo,bar");
+        assert(
+            Array.prototype.join.call({ length: 2, 0: "foo", 1: "bar", 2: "baz" }) === "foo,bar"
         );
-      },
-      ["foo", "bar", "baz"]
-    );
-  }
-
-  {
-    assertVisitsAll(
-      visit => {
-        Array.prototype.reduceRight.call(
-          o,
-          function (_, value) {
-            visit(value);
-            return false;
-          },
-          "initial"
+        assert(Array.prototype.join.call({ length: 3, 1: "bar" }, "~") === "~bar~");
+        assert(
+            Array.prototype.join.call({ length: 3, 0: "foo", 1: "bar", 2: "baz" }, "~") ===
+                "foo~bar~baz"
         );
-      },
-      ["baz", "bar", "foo"]
-    );
-  }
+    }
+
+    {
+        assert(Array.prototype.toString.call({}) === "[object Object]");
+        assert(Array.prototype.toString.call({ join: "foo" }) === "[object Object]");
+        assert(Array.prototype.toString.call({ join: () => "foo" }) === "foo");
+    }
+
+    {
+        assert(Array.prototype.indexOf.call({}) === -1);
+        assert(Array.prototype.indexOf.call({ 0: undefined }) === -1);
+        assert(Array.prototype.indexOf.call({ length: 1, 0: undefined }) === 0);
+        assert(Array.prototype.indexOf.call({ length: 1, 2: "foo" }, "foo") === -1);
+        assert(Array.prototype.indexOf.call({ length: 5, 2: "foo" }, "foo") === 2);
+        assert(Array.prototype.indexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", 3) === 4);
+    }
+
+    {
+        assert(Array.prototype.lastIndexOf.call({}) === -1);
+        assert(Array.prototype.lastIndexOf.call({ 0: undefined }) === -1);
+        assert(Array.prototype.lastIndexOf.call({ length: 1, 0: undefined }) === 0);
+        assert(Array.prototype.lastIndexOf.call({ length: 1, 2: "foo" }, "foo") === -1);
+        assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo" }, "foo") === 2);
+        assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo") === 4);
+        assert(
+            Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2) === 2
+        );
+    }
+
+    {
+        assert(Array.prototype.includes.call({}) === false);
+        assert(Array.prototype.includes.call({ 0: undefined }) === false);
+        assert(Array.prototype.includes.call({ length: 1, 0: undefined }) === true);
+        assert(Array.prototype.includes.call({ length: 1, 2: "foo" }, "foo") === false);
+        assert(Array.prototype.includes.call({ length: 5, 2: "foo" }, "foo") === true);
+    }
+
+    const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" };
+
+    {
+        assertVisitsAll(
+            visit => {
+                Array.prototype.every.call(o, function (value) {
+                    visit(value);
+                    return true;
+                });
+            },
+            ["foo", "bar", "baz"]
+        );
+    }
+
+    ["find", "findIndex"].forEach(name => {
+        assertVisitsAll(
+            visit => {
+                Array.prototype[name].call(o, function (value) {
+                    visit(value);
+                    return false;
+                });
+            },
+            ["foo", "bar", undefined, "baz", undefined]
+        );
+    });
+
+    ["filter", "forEach", "map", "some"].forEach(name => {
+        assertVisitsAll(
+            visit => {
+                Array.prototype[name].call(o, function (value) {
+                    visit(value);
+                    return false;
+                });
+            },
+            ["foo", "bar", "baz"]
+        );
+    });
+    {
+        assertVisitsAll(
+            visit => {
+                Array.prototype.reduce.call(
+                    o,
+                    function (_, value) {
+                        visit(value);
+                        return false;
+                    },
+                    "initial"
+                );
+            },
+            ["foo", "bar", "baz"]
+        );
+    }
+
+    {
+        assertVisitsAll(
+            visit => {
+                Array.prototype.reduceRight.call(
+                    o,
+                    function (_, value) {
+                        visit(value);
+                        return false;
+                    },
+                    "initial"
+                );
+            },
+            ["baz", "bar", "foo"]
+        );
+    }
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 24 - 24
Libraries/LibJS/Tests/builtins/Array/Array.prototype.concat.js

@@ -1,36 +1,36 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.concat.length === 1);
+    assert(Array.prototype.concat.length === 1);
 
-  var array = ["hello", "friends"];
+    var array = ["hello", "friends"];
 
-  var array_concat = array.concat();
-  assert(array_concat.length === array.length);
+    var array_concat = array.concat();
+    assert(array_concat.length === array.length);
 
-  array_concat = array.concat(1);
-  assert(array_concat.length === 3);
-  assert(array_concat[2] === 1);
+    array_concat = array.concat(1);
+    assert(array_concat.length === 3);
+    assert(array_concat[2] === 1);
 
-  array_concat = array.concat([1, 2, 3]);
-  assert(array_concat.length === 5);
-  assert(array_concat[2] === 1);
-  assert(array_concat[3] === 2);
-  assert(array_concat[4] === 3);
+    array_concat = array.concat([1, 2, 3]);
+    assert(array_concat.length === 5);
+    assert(array_concat[2] === 1);
+    assert(array_concat[3] === 2);
+    assert(array_concat[4] === 3);
 
-  array_concat = array.concat(false, "serenity");
-  assert(array_concat.length === 4);
-  assert(array_concat[2] === false);
-  assert(array_concat[3] === "serenity");
+    array_concat = array.concat(false, "serenity");
+    assert(array_concat.length === 4);
+    assert(array_concat[2] === false);
+    assert(array_concat[3] === "serenity");
 
-  array_concat = array.concat({ name: "libjs" }, [1, [2, 3]]);
-  assert(array_concat.length === 5);
-  assert(array_concat[2].name === "libjs");
-  assert(array_concat[3] === 1);
-  assert(array_concat[4][0] === 2);
-  assert(array_concat[4][1] === 3);
+    array_concat = array.concat({ name: "libjs" }, [1, [2, 3]]);
+    assert(array_concat.length === 5);
+    assert(array_concat[2].name === "libjs");
+    assert(array_concat[3] === 1);
+    assert(array_concat[4][0] === 2);
+    assert(array_concat[4][1] === 3);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 44 - 44
Libraries/LibJS/Tests/builtins/Array/Array.prototype.every.js

@@ -1,49 +1,49 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.every.length === 1);
-
-  assertThrowsError(
-    () => {
-      [].every(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
-
-  var arrayOne = ["serenity", { test: "serenity" }];
-  var arrayTwo = [true, false, 1, 2, 3, "3"];
-
-  assert(arrayOne.every(value => value === "hello") === false);
-  assert(arrayOne.every(value => value === "serenity") === false);
-  assert(arrayOne.every((value, index, arr) => index < 2) === true);
-  assert(arrayOne.every(value => typeof value === "string") === false);
-  assert(arrayOne.every(value => arrayOne.pop()) === true);
-
-  assert(arrayTwo.every((value, index, arr) => index > 0) === false);
-  assert(arrayTwo.every((value, index, arr) => index >= 0) === true);
-  assert(arrayTwo.every(value => typeof value !== "string") === false);
-  assert(arrayTwo.every(value => typeof value === "number") === false);
-  assert(arrayTwo.every(value => value > 0) === false);
-  assert(arrayTwo.every(value => value >= 0 && value < 4) === true);
-  assert(arrayTwo.every(value => arrayTwo.pop()) === true);
-
-  assert(["", "hello", "friends", "serenity"].every(value => value.length >= 0) === true);
-  assert([].every(value => value === 1) === true);
-
-  arrayTwo = [true, false, 1, 2, 3, "3"];
-
-  // Every only goes up to the original length.
-  assert(
-    arrayTwo.every((value, index, arr) => {
-      arr.push("serenity");
-      return value < 4;
-    }) === true
-  );
-
-  console.log("PASS");
+    assert(Array.prototype.every.length === 1);
+
+    assertThrowsError(
+        () => {
+            [].every(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
+
+    var arrayOne = ["serenity", { test: "serenity" }];
+    var arrayTwo = [true, false, 1, 2, 3, "3"];
+
+    assert(arrayOne.every(value => value === "hello") === false);
+    assert(arrayOne.every(value => value === "serenity") === false);
+    assert(arrayOne.every((value, index, arr) => index < 2) === true);
+    assert(arrayOne.every(value => typeof value === "string") === false);
+    assert(arrayOne.every(value => arrayOne.pop()) === true);
+
+    assert(arrayTwo.every((value, index, arr) => index > 0) === false);
+    assert(arrayTwo.every((value, index, arr) => index >= 0) === true);
+    assert(arrayTwo.every(value => typeof value !== "string") === false);
+    assert(arrayTwo.every(value => typeof value === "number") === false);
+    assert(arrayTwo.every(value => value > 0) === false);
+    assert(arrayTwo.every(value => value >= 0 && value < 4) === true);
+    assert(arrayTwo.every(value => arrayTwo.pop()) === true);
+
+    assert(["", "hello", "friends", "serenity"].every(value => value.length >= 0) === true);
+    assert([].every(value => value === 1) === true);
+
+    arrayTwo = [true, false, 1, 2, 3, "3"];
+
+    // Every only goes up to the original length.
+    assert(
+        arrayTwo.every((value, index, arr) => {
+            arr.push("serenity");
+            return value < 4;
+        }) === true
+    );
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 15 - 15
Libraries/LibJS/Tests/builtins/Array/Array.prototype.fill.js

@@ -1,23 +1,23 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.fill.length === 1);
+    assert(Array.prototype.fill.length === 1);
 
-  var array = [1, 2, 3, 4];
-  assertArrayEquals(array.fill(0, 2, 4), [1, 2, 0, 0]);
-  assertArrayEquals(array.fill(5, 1), [1, 5, 5, 5]);
-  assertArrayEquals(array.fill(6), [6, 6, 6, 6]);
+    var array = [1, 2, 3, 4];
+    assertArrayEquals(array.fill(0, 2, 4), [1, 2, 0, 0]);
+    assertArrayEquals(array.fill(5, 1), [1, 5, 5, 5]);
+    assertArrayEquals(array.fill(6), [6, 6, 6, 6]);
 
-  assertArrayEquals([1, 2, 3].fill(4), [4, 4, 4]);
-  assertArrayEquals([1, 2, 3].fill(4, 1), [1, 4, 4]);
-  assertArrayEquals([1, 2, 3].fill(4, 1, 2), [1, 4, 3]);
-  assertArrayEquals([1, 2, 3].fill(4, 3, 3), [1, 2, 3]);
-  assertArrayEquals([1, 2, 3].fill(4, -3, -2), [4, 2, 3]);
-  assertArrayEquals([1, 2, 3].fill(4, NaN, NaN), [1, 2, 3]);
-  assertArrayEquals([1, 2, 3].fill(4, 3, 5), [1, 2, 3]);
-  assertArrayEquals(Array(3).fill(4), [4, 4, 4]);
+    assertArrayEquals([1, 2, 3].fill(4), [4, 4, 4]);
+    assertArrayEquals([1, 2, 3].fill(4, 1), [1, 4, 4]);
+    assertArrayEquals([1, 2, 3].fill(4, 1, 2), [1, 4, 3]);
+    assertArrayEquals([1, 2, 3].fill(4, 3, 3), [1, 2, 3]);
+    assertArrayEquals([1, 2, 3].fill(4, -3, -2), [4, 2, 3]);
+    assertArrayEquals([1, 2, 3].fill(4, NaN, NaN), [1, 2, 3]);
+    assertArrayEquals([1, 2, 3].fill(4, 3, 5), [1, 2, 3]);
+    assertArrayEquals(Array(3).fill(4), [4, 4, 4]);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 62 - 62
Libraries/LibJS/Tests/builtins/Array/Array.prototype.filter.js

@@ -1,78 +1,78 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.filter.length === 1);
+    assert(Array.prototype.filter.length === 1);
 
-  assertThrowsError(
-    () => {
-      [].filter();
-    },
-    {
-      error: TypeError,
-      message: "Array.prototype.filter() requires at least one argument",
-    }
-  );
+    assertThrowsError(
+        () => {
+            [].filter();
+        },
+        {
+            error: TypeError,
+            message: "Array.prototype.filter() requires at least one argument",
+        }
+    );
 
-  assertThrowsError(
-    () => {
-      [].filter(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
+    assertThrowsError(
+        () => {
+            [].filter(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
 
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-  };
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+    };
 
-  assert([].filter(callback).length === 0);
-  assert(callbackCalled === 0);
+    assert([].filter(callback).length === 0);
+    assert(callbackCalled === 0);
 
-  assert([1, 2, 3].filter(callback).length === 0);
-  assert(callbackCalled === 3);
+    assert([1, 2, 3].filter(callback).length === 0);
+    assert(callbackCalled === 3);
 
-  var evenNumbers = [0, 1, 2, 3, 4, 5, 6, 7].filter(x => x % 2 === 0);
-  assert(evenNumbers.length === 4);
-  assert(evenNumbers[0] === 0);
-  assert(evenNumbers[1] === 2);
-  assert(evenNumbers[2] === 4);
-  assert(evenNumbers[3] === 6);
+    var evenNumbers = [0, 1, 2, 3, 4, 5, 6, 7].filter(x => x % 2 === 0);
+    assert(evenNumbers.length === 4);
+    assert(evenNumbers[0] === 0);
+    assert(evenNumbers[1] === 2);
+    assert(evenNumbers[2] === 4);
+    assert(evenNumbers[3] === 6);
 
-  var fruits = [
-    "Apple",
-    "Banana",
-    "Blueberry",
-    "Grape",
-    "Mango",
-    "Orange",
-    "Peach",
-    "Pineapple",
-    "Raspberry",
-    "Watermelon",
-  ];
-  const filterItems = (arr, query) => {
-    return arr.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) !== -1);
-  };
+    var fruits = [
+        "Apple",
+        "Banana",
+        "Blueberry",
+        "Grape",
+        "Mango",
+        "Orange",
+        "Peach",
+        "Pineapple",
+        "Raspberry",
+        "Watermelon",
+    ];
+    const filterItems = (arr, query) => {
+        return arr.filter(el => el.toLowerCase().indexOf(query.toLowerCase()) !== -1);
+    };
 
-  var results;
+    var results;
 
-  results = filterItems(fruits, "Berry");
-  assert(results.length === 2);
-  assert(results[0] === "Blueberry");
-  assert(results[1] === "Raspberry");
+    results = filterItems(fruits, "Berry");
+    assert(results.length === 2);
+    assert(results[0] === "Blueberry");
+    assert(results[1] === "Raspberry");
 
-  results = filterItems(fruits, "P");
-  assert(results.length === 5);
-  assert(results[0] === "Apple");
-  assert(results[1] === "Grape");
-  assert(results[2] === "Peach");
-  assert(results[3] === "Pineapple");
-  assert(results[4] === "Raspberry");
+    results = filterItems(fruits, "P");
+    assert(results.length === 5);
+    assert(results[0] === "Apple");
+    assert(results[1] === "Grape");
+    assert(results[2] === "Peach");
+    assert(results[3] === "Pineapple");
+    assert(results[4] === "Raspberry");
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 49 - 49
Libraries/LibJS/Tests/builtins/Array/Array.prototype.find.js

@@ -1,54 +1,54 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.find.length === 1);
-
-  assertThrowsError(
-    () => {
-      [].find(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
-
-  var array = ["hello", "friends", 1, 2, false];
-
-  assert(array.find(value => value === "hello") === "hello");
-  assert(array.find((value, index, arr) => index === 1) === "friends");
-  assert(array.find(value => value == "1") === 1);
-  assert(array.find(value => value === 1) === 1);
-  assert(array.find(value => typeof value !== "string") === 1);
-  assert(array.find(value => typeof value === "boolean") === false);
-  assert(array.find(value => value > 1) === 2);
-  assert(array.find(value => value > 1 && value < 3) === 2);
-  assert(array.find(value => value > 100) === undefined);
-  assert([].find(value => value === 1) === undefined);
-
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-  };
-
-  [].find(callback);
-  assert(callbackCalled === 0);
-
-  [1, 2, 3].find(callback);
-  assert(callbackCalled === 3);
-
-  callbackCalled = 0;
-  [1, , , "foo", , undefined, , ,].find(callback);
-  assert(callbackCalled === 8);
-
-  callbackCalled = 0;
-  [1, , , "foo", , undefined, , ,].find(value => {
-    callbackCalled++;
-    return value === undefined;
-  });
-  assert(callbackCalled === 2);
-
-  console.log("PASS");
+    assert(Array.prototype.find.length === 1);
+
+    assertThrowsError(
+        () => {
+            [].find(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
+
+    var array = ["hello", "friends", 1, 2, false];
+
+    assert(array.find(value => value === "hello") === "hello");
+    assert(array.find((value, index, arr) => index === 1) === "friends");
+    assert(array.find(value => value == "1") === 1);
+    assert(array.find(value => value === 1) === 1);
+    assert(array.find(value => typeof value !== "string") === 1);
+    assert(array.find(value => typeof value === "boolean") === false);
+    assert(array.find(value => value > 1) === 2);
+    assert(array.find(value => value > 1 && value < 3) === 2);
+    assert(array.find(value => value > 100) === undefined);
+    assert([].find(value => value === 1) === undefined);
+
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+    };
+
+    [].find(callback);
+    assert(callbackCalled === 0);
+
+    [1, 2, 3].find(callback);
+    assert(callbackCalled === 3);
+
+    callbackCalled = 0;
+    [1, , , "foo", , undefined, , ,].find(callback);
+    assert(callbackCalled === 8);
+
+    callbackCalled = 0;
+    [1, , , "foo", , undefined, , ,].find(value => {
+        callbackCalled++;
+        return value === undefined;
+    });
+    assert(callbackCalled === 2);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 49 - 49
Libraries/LibJS/Tests/builtins/Array/Array.prototype.findIndex.js

@@ -1,54 +1,54 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.findIndex.length === 1);
-
-  assertThrowsError(
-    () => {
-      [].findIndex(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
-
-  var array = ["hello", "friends", 1, 2, false];
-
-  assert(array.findIndex(value => value === "hello") === 0);
-  assert(array.findIndex((value, index, arr) => index === 1) === 1);
-  assert(array.findIndex(value => value == "1") === 2);
-  assert(array.findIndex(value => value === 1) === 2);
-  assert(array.findIndex(value => typeof value !== "string") === 2);
-  assert(array.findIndex(value => typeof value === "boolean") === 4);
-  assert(array.findIndex(value => value > 1) === 3);
-  assert(array.findIndex(value => value > 1 && value < 3) === 3);
-  assert(array.findIndex(value => value > 100) === -1);
-  assert([].findIndex(value => value === 1) === -1);
-
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-  };
-
-  [].findIndex(callback);
-  assert(callbackCalled === 0);
-
-  [1, 2, 3].findIndex(callback);
-  assert(callbackCalled === 3);
-
-  callbackCalled = 0;
-  [1, , , "foo", , undefined, , ,].findIndex(callback);
-  assert(callbackCalled === 8);
-
-  callbackCalled = 0;
-  [1, , , "foo", , undefined, , ,].findIndex(value => {
-    callbackCalled++;
-    return value === undefined;
-  });
-  assert(callbackCalled === 2);
-
-  console.log("PASS");
+    assert(Array.prototype.findIndex.length === 1);
+
+    assertThrowsError(
+        () => {
+            [].findIndex(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
+
+    var array = ["hello", "friends", 1, 2, false];
+
+    assert(array.findIndex(value => value === "hello") === 0);
+    assert(array.findIndex((value, index, arr) => index === 1) === 1);
+    assert(array.findIndex(value => value == "1") === 2);
+    assert(array.findIndex(value => value === 1) === 2);
+    assert(array.findIndex(value => typeof value !== "string") === 2);
+    assert(array.findIndex(value => typeof value === "boolean") === 4);
+    assert(array.findIndex(value => value > 1) === 3);
+    assert(array.findIndex(value => value > 1 && value < 3) === 3);
+    assert(array.findIndex(value => value > 100) === -1);
+    assert([].findIndex(value => value === 1) === -1);
+
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+    };
+
+    [].findIndex(callback);
+    assert(callbackCalled === 0);
+
+    [1, 2, 3].findIndex(callback);
+    assert(callbackCalled === 3);
+
+    callbackCalled = 0;
+    [1, , , "foo", , undefined, , ,].findIndex(callback);
+    assert(callbackCalled === 8);
+
+    callbackCalled = 0;
+    [1, , , "foo", , undefined, , ,].findIndex(value => {
+        callbackCalled++;
+        return value === undefined;
+    });
+    assert(callbackCalled === 2);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 56 - 56
Libraries/LibJS/Tests/builtins/Array/Array.prototype.forEach.js

@@ -1,70 +1,70 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.forEach.length === 1);
+    assert(Array.prototype.forEach.length === 1);
 
-  assertThrowsError(
-    () => {
-      [].forEach();
-    },
-    {
-      error: TypeError,
-      message: "Array.prototype.forEach() requires at least one argument",
-    }
-  );
+    assertThrowsError(
+        () => {
+            [].forEach();
+        },
+        {
+            error: TypeError,
+            message: "Array.prototype.forEach() requires at least one argument",
+        }
+    );
 
-  assertThrowsError(
-    () => {
-      [].forEach(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
+    assertThrowsError(
+        () => {
+            [].forEach(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
 
-  var a = [1, 2, 3];
-  var o = {};
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-  };
+    var a = [1, 2, 3];
+    var o = {};
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+    };
 
-  assert([].forEach(callback) === undefined);
-  assert(callbackCalled === 0);
+    assert([].forEach(callback) === undefined);
+    assert(callbackCalled === 0);
 
-  assert(a.forEach(callback) === undefined);
-  assert(callbackCalled === 3);
+    assert(a.forEach(callback) === undefined);
+    assert(callbackCalled === 3);
 
-  callbackCalled = 0;
-  a.forEach(function (value, index) {
-    assert(value === a[index]);
-    assert(index === a[index] - 1);
-  });
+    callbackCalled = 0;
+    a.forEach(function (value, index) {
+        assert(value === a[index]);
+        assert(index === a[index] - 1);
+    });
 
-  callbackCalled = 0;
-  a.forEach(function (_, _, array) {
-    callbackCalled++;
-    assert(a.length === array.length);
-    a.push("test");
-  });
-  assert(callbackCalled === 3);
-  assert(a.length === 6);
+    callbackCalled = 0;
+    a.forEach(function (_, _, array) {
+        callbackCalled++;
+        assert(a.length === array.length);
+        a.push("test");
+    });
+    assert(callbackCalled === 3);
+    assert(a.length === 6);
 
-  callbackCalled = 0;
-  a.forEach(function (value, index) {
-    callbackCalled++;
-    this[index] = value;
-  }, o);
-  assert(callbackCalled === 6);
-  assert(o[0] === 1);
-  assert(o[1] === 2);
-  assert(o[2] === 3);
-  assert(o[3] === "test");
-  assert(o[4] === "test");
-  assert(o[5] === "test");
+    callbackCalled = 0;
+    a.forEach(function (value, index) {
+        callbackCalled++;
+        this[index] = value;
+    }, o);
+    assert(callbackCalled === 6);
+    assert(o[0] === 1);
+    assert(o[1] === 2);
+    assert(o[2] === 3);
+    assert(o[3] === "test");
+    assert(o[4] === "test");
+    assert(o[5] === "test");
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 14 - 14
Libraries/LibJS/Tests/builtins/Array/Array.prototype.includes.js

@@ -1,22 +1,22 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.includes.length === 1);
+    assert(Array.prototype.includes.length === 1);
 
-  var array = ["hello", "friends", 1, 2, false];
+    var array = ["hello", "friends", 1, 2, false];
 
-  assert([].includes() === false);
-  assert([undefined].includes() === true);
-  assert(array.includes("hello") === true);
-  assert(array.includes(1) === true);
-  assert(array.includes(1, -3) === true);
-  assert(array.includes("serenity") === false);
-  assert(array.includes(false, -1) === true);
-  assert(array.includes(2, -1) === false);
-  assert(array.includes(2, -100) === true);
-  assert(array.includes("friends", 100) === false);
+    assert([].includes() === false);
+    assert([undefined].includes() === true);
+    assert(array.includes("hello") === true);
+    assert(array.includes(1) === true);
+    assert(array.includes(1, -3) === true);
+    assert(array.includes("serenity") === false);
+    assert(array.includes(false, -1) === true);
+    assert(array.includes(2, -1) === false);
+    assert(array.includes(2, -100) === true);
+    assert(array.includes("friends", 100) === false);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 21 - 21
Libraries/LibJS/Tests/builtins/Array/Array.prototype.indexOf.js

@@ -1,29 +1,29 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.indexOf.length === 1);
+    assert(Array.prototype.indexOf.length === 1);
 
-  var array = ["hello", "friends", 1, 2, false];
+    var array = ["hello", "friends", 1, 2, false];
 
-  assert(array.indexOf("hello") === 0);
-  assert(array.indexOf("friends") === 1);
-  assert(array.indexOf(false) === 4);
-  assert(array.indexOf(false, 2) === 4);
-  assert(array.indexOf(false, -2) === 4);
-  assert(array.indexOf(1) === 2);
-  assert(array.indexOf(1, 1000) === -1);
-  assert(array.indexOf(1, -1000) === 2);
-  assert(array.indexOf("serenity") === -1);
-  assert(array.indexOf(false, -1) === 4);
-  assert(array.indexOf(2, -1) === -1);
-  assert(array.indexOf(2, -2) === 3);
-  assert([].indexOf("serenity") === -1);
-  assert([].indexOf("serenity", 10) === -1);
-  assert([].indexOf("serenity", -10) === -1);
-  assert([].indexOf() === -1);
-  assert([undefined].indexOf() === 0);
+    assert(array.indexOf("hello") === 0);
+    assert(array.indexOf("friends") === 1);
+    assert(array.indexOf(false) === 4);
+    assert(array.indexOf(false, 2) === 4);
+    assert(array.indexOf(false, -2) === 4);
+    assert(array.indexOf(1) === 2);
+    assert(array.indexOf(1, 1000) === -1);
+    assert(array.indexOf(1, -1000) === 2);
+    assert(array.indexOf("serenity") === -1);
+    assert(array.indexOf(false, -1) === 4);
+    assert(array.indexOf(2, -1) === -1);
+    assert(array.indexOf(2, -2) === 3);
+    assert([].indexOf("serenity") === -1);
+    assert([].indexOf("serenity", 10) === -1);
+    assert([].indexOf("serenity", -10) === -1);
+    assert([].indexOf() === -1);
+    assert([undefined].indexOf() === 0);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 12 - 12
Libraries/LibJS/Tests/builtins/Array/Array.prototype.join.js

@@ -1,19 +1,19 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.join.length === 1);
+    assert(Array.prototype.join.length === 1);
 
-  assert(["hello", "friends"].join() === "hello,friends");
-  assert(["hello", "friends"].join(" ") === "hello friends");
-  assert(["hello", "friends", "foo"].join("~", "#") === "hello~friends~foo");
-  assert([].join() === "");
-  assert([null].join() === "");
-  assert([undefined].join() === "");
-  assert([undefined, null, ""].join() === ",,");
-  assert([1, null, 2, undefined, 3].join() === "1,,2,,3");
-  assert(Array(3).join() === ",,");
+    assert(["hello", "friends"].join() === "hello,friends");
+    assert(["hello", "friends"].join(" ") === "hello friends");
+    assert(["hello", "friends", "foo"].join("~", "#") === "hello~friends~foo");
+    assert([].join() === "");
+    assert([null].join() === "");
+    assert([undefined].join() === "");
+    assert([undefined, null, ""].join() === ",,");
+    assert([1, null, 2, undefined, 3].join() === "1,,2,,3");
+    assert(Array(3).join() === ",,");
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 18 - 18
Libraries/LibJS/Tests/builtins/Array/Array.prototype.lastIndexOf.js

@@ -1,26 +1,26 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.lastIndexOf.length === 1);
+    assert(Array.prototype.lastIndexOf.length === 1);
 
-  var array = [1, 2, 3, 1, "hello"];
+    var array = [1, 2, 3, 1, "hello"];
 
-  assert(array.lastIndexOf("hello") === 4);
-  assert(array.lastIndexOf("hello", 1000) === 4);
-  assert(array.lastIndexOf(1) === 3);
-  assert(array.lastIndexOf(1, -1) === 3);
-  assert(array.lastIndexOf(1, -2) === 3);
-  assert(array.lastIndexOf(2) === 1);
-  assert(array.lastIndexOf(2, -3) === 1);
-  assert(array.lastIndexOf(2, -4) === 1);
-  assert([].lastIndexOf("hello") === -1);
-  assert([].lastIndexOf("hello", 10) === -1);
-  assert([].lastIndexOf("hello", -10) === -1);
-  assert([].lastIndexOf() === -1);
-  assert([undefined].lastIndexOf() === 0);
-  assert([undefined, undefined, undefined].lastIndexOf() === 2);
+    assert(array.lastIndexOf("hello") === 4);
+    assert(array.lastIndexOf("hello", 1000) === 4);
+    assert(array.lastIndexOf(1) === 3);
+    assert(array.lastIndexOf(1, -1) === 3);
+    assert(array.lastIndexOf(1, -2) === 3);
+    assert(array.lastIndexOf(2) === 1);
+    assert(array.lastIndexOf(2, -3) === 1);
+    assert(array.lastIndexOf(2, -4) === 1);
+    assert([].lastIndexOf("hello") === -1);
+    assert([].lastIndexOf("hello", 10) === -1);
+    assert([].lastIndexOf("hello", -10) === -1);
+    assert([].lastIndexOf() === -1);
+    assert([undefined].lastIndexOf() === 0);
+    assert([undefined, undefined, undefined].lastIndexOf() === 2);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 58 - 58
Libraries/LibJS/Tests/builtins/Array/Array.prototype.map.js

@@ -1,63 +1,63 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.map.length === 1);
-
-  assertThrowsError(
-    () => {
-      [].map();
-    },
-    {
-      error: TypeError,
-      message: "Array.prototype.map() requires at least one argument",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [].map(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
-
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-  };
-
-  assert([].map(callback).length === 0);
-  assert(callbackCalled === 0);
-
-  assert([1, 2, 3].map(callback).length === 3);
-  assert(callbackCalled === 3);
-
-  callbackCalled = 0;
-  assert([1, , , "foo", , undefined, , ,].map(callback).length === 8);
-  assert(callbackCalled === 3);
-
-  var results = [undefined, null, true, "foo", 42, {}].map(
-    (value, index) => "" + index + " -> " + value
-  );
-  assert(results.length === 6);
-  assert(results[0] === "0 -> undefined");
-  assert(results[1] === "1 -> null");
-  assert(results[2] === "2 -> true");
-  assert(results[3] === "3 -> foo");
-  assert(results[4] === "4 -> 42");
-  assert(results[5] === "5 -> [object Object]");
-
-  var squaredNumbers = [0, 1, 2, 3, 4].map(x => x ** 2);
-  assert(squaredNumbers.length === 5);
-  assert(squaredNumbers[0] === 0);
-  assert(squaredNumbers[1] === 1);
-  assert(squaredNumbers[2] === 4);
-  assert(squaredNumbers[3] === 9);
-  assert(squaredNumbers[4] === 16);
-
-  console.log("PASS");
+    assert(Array.prototype.map.length === 1);
+
+    assertThrowsError(
+        () => {
+            [].map();
+        },
+        {
+            error: TypeError,
+            message: "Array.prototype.map() requires at least one argument",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [].map(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
+
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+    };
+
+    assert([].map(callback).length === 0);
+    assert(callbackCalled === 0);
+
+    assert([1, 2, 3].map(callback).length === 3);
+    assert(callbackCalled === 3);
+
+    callbackCalled = 0;
+    assert([1, , , "foo", , undefined, , ,].map(callback).length === 8);
+    assert(callbackCalled === 3);
+
+    var results = [undefined, null, true, "foo", 42, {}].map(
+        (value, index) => "" + index + " -> " + value
+    );
+    assert(results.length === 6);
+    assert(results[0] === "0 -> undefined");
+    assert(results[1] === "1 -> null");
+    assert(results[2] === "2 -> true");
+    assert(results[3] === "3 -> foo");
+    assert(results[4] === "4 -> 42");
+    assert(results[5] === "5 -> [object Object]");
+
+    var squaredNumbers = [0, 1, 2, 3, 4].map(x => x ** 2);
+    assert(squaredNumbers.length === 5);
+    assert(squaredNumbers[0] === 0);
+    assert(squaredNumbers[1] === 1);
+    assert(squaredNumbers[2] === 4);
+    assert(squaredNumbers[3] === 9);
+    assert(squaredNumbers[4] === 16);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 13 - 13
Libraries/LibJS/Tests/builtins/Array/Array.prototype.pop.js

@@ -1,21 +1,21 @@
 load("test-common.js");
 
 try {
-  var a = [1, 2, 3];
-  var value = a.pop();
-  assert(value === 3);
-  assert(a.length === 2);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
+    var a = [1, 2, 3];
+    var value = a.pop();
+    assert(value === 3);
+    assert(a.length === 2);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
 
-  var a = [];
-  var value = a.pop();
-  assert(value === undefined);
-  assert(a.length === 0);
+    var a = [];
+    var value = a.pop();
+    assert(value === undefined);
+    assert(a.length === 0);
 
-  assert([,].pop() === undefined);
+    assert([,].pop() === undefined);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 21 - 21
Libraries/LibJS/Tests/builtins/Array/Array.prototype.push.js

@@ -1,30 +1,30 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.push.length === 1);
+    assert(Array.prototype.push.length === 1);
 
-  var a = ["hello"];
-  var length = a.push();
-  assert(length === 1);
-  assert(a.length === 1);
-  assert(a[0] === "hello");
+    var a = ["hello"];
+    var length = a.push();
+    assert(length === 1);
+    assert(a.length === 1);
+    assert(a[0] === "hello");
 
-  length = a.push("friends");
-  assert(length === 2);
-  assert(a.length === 2);
-  assert(a[0] === "hello");
-  assert(a[1] === "friends");
+    length = a.push("friends");
+    assert(length === 2);
+    assert(a.length === 2);
+    assert(a[0] === "hello");
+    assert(a[1] === "friends");
 
-  length = a.push(1, 2, 3);
-  assert(length === 5);
-  assert(a.length === 5);
-  assert(a[0] === "hello");
-  assert(a[1] === "friends");
-  assert(a[2] === 1);
-  assert(a[3] === 2);
-  assert(a[4] === 3);
+    length = a.push(1, 2, 3);
+    assert(length === 5);
+    assert(a.length === 5);
+    assert(a[0] === "hello");
+    assert(a[1] === "friends");
+    assert(a[2] === 1);
+    assert(a[3] === 2);
+    assert(a[4] === 3);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 127 - 127
Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduce.js

@@ -1,132 +1,132 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.reduce.length === 1);
-
-  assertThrowsError(
-    () => {
-      [1].reduce();
-    },
-    {
-      error: TypeError,
-      message: "Array.prototype.reduce() requires at least one argument",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [1].reduce(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [].reduce((a, x) => x);
-    },
-    {
-      error: TypeError,
-      message: "Reduce of empty array with no initial value",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [, ,].reduce((a, x) => x);
-    },
-    {
-      error: TypeError,
-      message: "Reduce of empty array with no initial value",
-    }
-  );
-
-  [1, 2].reduce(function () {
-    assert(this === undefined);
-  });
-
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-    return true;
-  };
-
-  assert([1].reduce(callback) === 1);
-  assert(callbackCalled === 0);
-
-  assert([, 1].reduce(callback) === 1);
-  assert(callbackCalled === 0);
-
-  callbackCalled = 0;
-  assert([1, 2, 3].reduce(callback) === true);
-  assert(callbackCalled === 2);
-
-  callbackCalled = 0;
-  assert([, , 1, 2, 3].reduce(callback) === true);
-  assert(callbackCalled === 2);
-
-  callbackCalled = 0;
-  assert([1, , , 10, , 100, , ,].reduce(callback) === true);
-  assert(callbackCalled === 2);
-
-  var constantlySad = () => ":^(";
-  var result = [].reduce(constantlySad, ":^)");
-  assert(result === ":^)");
-
-  result = [":^0"].reduce(constantlySad, ":^)");
-  assert(result === ":^(");
-
-  result = [":^0"].reduce(constantlySad);
-  assert(result === ":^0");
-
-  result = [5, 4, 3, 2, 1].reduce((accum, elem) => accum + elem);
-  assert(result === 15);
-
-  result = [1, 2, 3, 4, 5, 6].reduce((accum, elem) => accum + elem, 100);
-  assert(result === 121);
-
-  result = [6, 5, 4, 3, 2, 1].reduce((accum, elem) => {
-    return accum + elem;
-  }, 100);
-  assert(result === 121);
-
-  var indexes = [];
-  result = ["foo", 1, true].reduce((a, v, i) => {
-    indexes.push(i);
-  });
-  assert(result === undefined);
-  assert(indexes.length === 2);
-  assert(indexes[0] === 1);
-  assert(indexes[1] === 2);
-
-  indexes = [];
-  result = ["foo", 1, true].reduce((a, v, i) => {
-    indexes.push(i);
-  }, "foo");
-  assert(result === undefined);
-  assert(indexes.length === 3);
-  assert(indexes[0] === 0);
-  assert(indexes[1] === 1);
-  assert(indexes[2] === 2);
-
-  var mutable = { prop: 0 };
-  result = ["foo", 1, true].reduce((a, v) => {
-    a.prop = v;
-    return a;
-  }, mutable);
-  assert(result === mutable);
-  assert(result.prop === true);
-
-  var a1 = [1, 2];
-  var a2 = null;
-  a1.reduce((a, v, i, t) => {
-    a2 = t;
-  });
-  assert(a1 === a2);
-
-  console.log("PASS");
+    assert(Array.prototype.reduce.length === 1);
+
+    assertThrowsError(
+        () => {
+            [1].reduce();
+        },
+        {
+            error: TypeError,
+            message: "Array.prototype.reduce() requires at least one argument",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [1].reduce(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [].reduce((a, x) => x);
+        },
+        {
+            error: TypeError,
+            message: "Reduce of empty array with no initial value",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [, ,].reduce((a, x) => x);
+        },
+        {
+            error: TypeError,
+            message: "Reduce of empty array with no initial value",
+        }
+    );
+
+    [1, 2].reduce(function () {
+        assert(this === undefined);
+    });
+
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+        return true;
+    };
+
+    assert([1].reduce(callback) === 1);
+    assert(callbackCalled === 0);
+
+    assert([, 1].reduce(callback) === 1);
+    assert(callbackCalled === 0);
+
+    callbackCalled = 0;
+    assert([1, 2, 3].reduce(callback) === true);
+    assert(callbackCalled === 2);
+
+    callbackCalled = 0;
+    assert([, , 1, 2, 3].reduce(callback) === true);
+    assert(callbackCalled === 2);
+
+    callbackCalled = 0;
+    assert([1, , , 10, , 100, , ,].reduce(callback) === true);
+    assert(callbackCalled === 2);
+
+    var constantlySad = () => ":^(";
+    var result = [].reduce(constantlySad, ":^)");
+    assert(result === ":^)");
+
+    result = [":^0"].reduce(constantlySad, ":^)");
+    assert(result === ":^(");
+
+    result = [":^0"].reduce(constantlySad);
+    assert(result === ":^0");
+
+    result = [5, 4, 3, 2, 1].reduce((accum, elem) => accum + elem);
+    assert(result === 15);
+
+    result = [1, 2, 3, 4, 5, 6].reduce((accum, elem) => accum + elem, 100);
+    assert(result === 121);
+
+    result = [6, 5, 4, 3, 2, 1].reduce((accum, elem) => {
+        return accum + elem;
+    }, 100);
+    assert(result === 121);
+
+    var indexes = [];
+    result = ["foo", 1, true].reduce((a, v, i) => {
+        indexes.push(i);
+    });
+    assert(result === undefined);
+    assert(indexes.length === 2);
+    assert(indexes[0] === 1);
+    assert(indexes[1] === 2);
+
+    indexes = [];
+    result = ["foo", 1, true].reduce((a, v, i) => {
+        indexes.push(i);
+    }, "foo");
+    assert(result === undefined);
+    assert(indexes.length === 3);
+    assert(indexes[0] === 0);
+    assert(indexes[1] === 1);
+    assert(indexes[2] === 2);
+
+    var mutable = { prop: 0 };
+    result = ["foo", 1, true].reduce((a, v) => {
+        a.prop = v;
+        return a;
+    }, mutable);
+    assert(result === mutable);
+    assert(result.prop === true);
+
+    var a1 = [1, 2];
+    var a2 = null;
+    a1.reduce((a, v, i, t) => {
+        a2 = t;
+    });
+    assert(a1 === a2);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 129 - 129
Libraries/LibJS/Tests/builtins/Array/Array.prototype.reduceRight.js

@@ -1,134 +1,134 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.reduceRight.length === 1);
-
-  assertThrowsError(
-    () => {
-      [1].reduceRight();
-    },
-    {
-      error: TypeError,
-      message: "Array.prototype.reduceRight() requires at least one argument",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [1].reduceRight(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [].reduceRight((a, x) => x);
-    },
-    {
-      error: TypeError,
-      message: "Reduce of empty array with no initial value",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [, ,].reduceRight((a, x) => x);
-    },
-    {
-      error: TypeError,
-      message: "Reduce of empty array with no initial value",
-    }
-  );
-
-  [1, 2].reduceRight(function () {
-    assert(this === undefined);
-  });
-
-  var callbackCalled = 0;
-  var callback = () => {
-    callbackCalled++;
-    return true;
-  };
-
-  assert([1].reduceRight(callback) === 1);
-  assert(callbackCalled === 0);
-
-  assert([1].reduceRight(callback) === 1);
-  assert(callbackCalled === 0);
-
-  callbackCalled = 0;
-  assert([1, 2, 3].reduceRight(callback) === true);
-  assert(callbackCalled === 2);
-
-  callbackCalled = 0;
-  assert([1, 2, 3, ,].reduceRight(callback) === true);
-  assert(callbackCalled === 2);
-
-  callbackCalled = 0;
-  assert([, , , 1, , , 10, , 100, , ,].reduceRight(callback) === true);
-  assert(callbackCalled === 2);
-
-  var constantlySad = () => ":^(";
-  var result = [].reduceRight(constantlySad, ":^)");
-  assert(result === ":^)");
-
-  result = [":^0"].reduceRight(constantlySad, ":^)");
-  assert(result === ":^(");
-
-  result = [":^0"].reduceRight(constantlySad);
-  assert(result === ":^0");
-
-  result = [5, 4, 3, 2, 1].reduceRight((accum, elem) => "" + accum + elem);
-  assert(result === "12345");
-
-  result = [1, 2, 3, 4, 5, 6].reduceRight((accum, elem) => {
-    return "" + accum + elem;
-  }, 100);
-  assert(result === "100654321");
-
-  result = [6, 5, 4, 3, 2, 1].reduceRight((accum, elem) => {
-    return "" + accum + elem;
-  }, 100);
-  assert(result === "100123456");
-
-  var indexes = [];
-  result = ["foo", 1, true].reduceRight((a, v, i) => {
-    indexes.push(i);
-  });
-  assert(result === undefined);
-  assert(indexes.length === 2);
-  assert(indexes[0] === 1);
-  assert(indexes[1] === 0);
-
-  indexes = [];
-  result = ["foo", 1, true].reduceRight((a, v, i) => {
-    indexes.push(i);
-  }, "foo");
-  assert(result === undefined);
-  assert(indexes.length === 3);
-  assert(indexes[0] === 2);
-  assert(indexes[1] === 1);
-  assert(indexes[2] === 0);
-
-  var mutable = { prop: 0 };
-  result = ["foo", 1, true].reduceRight((a, v) => {
-    a.prop = v;
-    return a;
-  }, mutable);
-  assert(result === mutable);
-  assert(result.prop === "foo");
-
-  var a1 = [1, 2];
-  var a2 = null;
-  a1.reduceRight((a, v, i, t) => {
-    a2 = t;
-  });
-  assert(a1 === a2);
-
-  console.log("PASS");
+    assert(Array.prototype.reduceRight.length === 1);
+
+    assertThrowsError(
+        () => {
+            [1].reduceRight();
+        },
+        {
+            error: TypeError,
+            message: "Array.prototype.reduceRight() requires at least one argument",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [1].reduceRight(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [].reduceRight((a, x) => x);
+        },
+        {
+            error: TypeError,
+            message: "Reduce of empty array with no initial value",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [, ,].reduceRight((a, x) => x);
+        },
+        {
+            error: TypeError,
+            message: "Reduce of empty array with no initial value",
+        }
+    );
+
+    [1, 2].reduceRight(function () {
+        assert(this === undefined);
+    });
+
+    var callbackCalled = 0;
+    var callback = () => {
+        callbackCalled++;
+        return true;
+    };
+
+    assert([1].reduceRight(callback) === 1);
+    assert(callbackCalled === 0);
+
+    assert([1].reduceRight(callback) === 1);
+    assert(callbackCalled === 0);
+
+    callbackCalled = 0;
+    assert([1, 2, 3].reduceRight(callback) === true);
+    assert(callbackCalled === 2);
+
+    callbackCalled = 0;
+    assert([1, 2, 3, ,].reduceRight(callback) === true);
+    assert(callbackCalled === 2);
+
+    callbackCalled = 0;
+    assert([, , , 1, , , 10, , 100, , ,].reduceRight(callback) === true);
+    assert(callbackCalled === 2);
+
+    var constantlySad = () => ":^(";
+    var result = [].reduceRight(constantlySad, ":^)");
+    assert(result === ":^)");
+
+    result = [":^0"].reduceRight(constantlySad, ":^)");
+    assert(result === ":^(");
+
+    result = [":^0"].reduceRight(constantlySad);
+    assert(result === ":^0");
+
+    result = [5, 4, 3, 2, 1].reduceRight((accum, elem) => "" + accum + elem);
+    assert(result === "12345");
+
+    result = [1, 2, 3, 4, 5, 6].reduceRight((accum, elem) => {
+        return "" + accum + elem;
+    }, 100);
+    assert(result === "100654321");
+
+    result = [6, 5, 4, 3, 2, 1].reduceRight((accum, elem) => {
+        return "" + accum + elem;
+    }, 100);
+    assert(result === "100123456");
+
+    var indexes = [];
+    result = ["foo", 1, true].reduceRight((a, v, i) => {
+        indexes.push(i);
+    });
+    assert(result === undefined);
+    assert(indexes.length === 2);
+    assert(indexes[0] === 1);
+    assert(indexes[1] === 0);
+
+    indexes = [];
+    result = ["foo", 1, true].reduceRight((a, v, i) => {
+        indexes.push(i);
+    }, "foo");
+    assert(result === undefined);
+    assert(indexes.length === 3);
+    assert(indexes[0] === 2);
+    assert(indexes[1] === 1);
+    assert(indexes[2] === 0);
+
+    var mutable = { prop: 0 };
+    result = ["foo", 1, true].reduceRight((a, v) => {
+        a.prop = v;
+        return a;
+    }, mutable);
+    assert(result === mutable);
+    assert(result.prop === "foo");
+
+    var a1 = [1, 2];
+    var a2 = null;
+    a1.reduceRight((a, v, i, t) => {
+        a2 = t;
+    });
+    assert(a1 === a2);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 18 - 18
Libraries/LibJS/Tests/builtins/Array/Array.prototype.reverse.js

@@ -1,31 +1,31 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.reverse.length === 0);
+    assert(Array.prototype.reverse.length === 0);
 
-  var array = [1, 2, 3];
+    var array = [1, 2, 3];
 
-  assert(array[0] === 1);
-  assert(array[1] === 2);
-  assert(array[2] === 3);
+    assert(array[0] === 1);
+    assert(array[1] === 2);
+    assert(array[2] === 3);
 
-  array.reverse();
+    array.reverse();
 
-  assert(array[0] === 3);
-  assert(array[1] === 2);
-  assert(array[2] === 1);
+    assert(array[0] === 3);
+    assert(array[1] === 2);
+    assert(array[2] === 1);
 
-  var array_ref = array.reverse();
+    var array_ref = array.reverse();
 
-  assert(array_ref[0] === 1);
-  assert(array_ref[1] === 2);
-  assert(array_ref[2] === 3);
+    assert(array_ref[0] === 1);
+    assert(array_ref[1] === 2);
+    assert(array_ref[2] === 3);
 
-  assert(array[0] === 1);
-  assert(array[1] === 2);
-  assert(array[2] === 3);
+    assert(array[0] === 1);
+    assert(array[1] === 2);
+    assert(array[2] === 3);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 13 - 13
Libraries/LibJS/Tests/builtins/Array/Array.prototype.shift.js

@@ -1,21 +1,21 @@
 load("test-common.js");
 
 try {
-  var a = [1, 2, 3];
-  var value = a.shift();
-  assert(value === 1);
-  assert(a.length === 2);
-  assert(a[0] === 2);
-  assert(a[1] === 3);
+    var a = [1, 2, 3];
+    var value = a.shift();
+    assert(value === 1);
+    assert(a.length === 2);
+    assert(a[0] === 2);
+    assert(a[1] === 3);
 
-  var a = [];
-  var value = a.shift();
-  assert(value === undefined);
-  assert(a.length === 0);
+    var a = [];
+    var value = a.shift();
+    assert(value === undefined);
+    assert(a.length === 0);
 
-  assert([,].shift() === undefined);
+    assert([,].shift() === undefined);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 48 - 48
Libraries/LibJS/Tests/builtins/Array/Array.prototype.slice.js

@@ -1,53 +1,53 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.slice.length === 2);
-
-  var array = ["hello", "friends", "serenity", 1];
-
-  var array_slice = array.slice();
-  assert(array_slice.length === array.length);
-  assert(array_slice.length === 4);
-  assert(array_slice[0] === "hello");
-  assert(array_slice[1] === "friends");
-  assert(array_slice[2] === "serenity");
-  assert(array_slice[3] === 1);
-
-  array_slice = array.slice(1);
-  assert(array_slice.length === 3);
-  assert(array_slice[0] === "friends");
-  assert(array_slice[1] === "serenity");
-  assert(array_slice[2] === 1);
-
-  array_slice = array.slice(0, 2);
-  assert(array_slice.length === 2);
-  assert(array_slice[0] === "hello");
-  assert(array_slice[1] === "friends");
-
-  array_slice = array.slice(-1);
-  assert(array_slice.length === 1);
-  assert(array_slice[0] === 1);
-
-  array_slice = array.slice(1, 1);
-  assert(array_slice.length === 0);
-
-  array_slice = array.slice(1, -1);
-  assert(array_slice.length === 2);
-  assert(array_slice[0] === "friends");
-  assert(array_slice[1] === "serenity");
-
-  array_slice = array.slice(2, -1);
-  assert(array_slice.length === 1);
-  assert(array_slice[0] === "serenity");
-
-  array_slice = array.slice(0, 100);
-  assert(array_slice.length === 4);
-  assert(array_slice[0] === "hello");
-  assert(array_slice[1] === "friends");
-  assert(array_slice[2] === "serenity");
-  assert(array_slice[3] === 1);
-
-  console.log("PASS");
+    assert(Array.prototype.slice.length === 2);
+
+    var array = ["hello", "friends", "serenity", 1];
+
+    var array_slice = array.slice();
+    assert(array_slice.length === array.length);
+    assert(array_slice.length === 4);
+    assert(array_slice[0] === "hello");
+    assert(array_slice[1] === "friends");
+    assert(array_slice[2] === "serenity");
+    assert(array_slice[3] === 1);
+
+    array_slice = array.slice(1);
+    assert(array_slice.length === 3);
+    assert(array_slice[0] === "friends");
+    assert(array_slice[1] === "serenity");
+    assert(array_slice[2] === 1);
+
+    array_slice = array.slice(0, 2);
+    assert(array_slice.length === 2);
+    assert(array_slice[0] === "hello");
+    assert(array_slice[1] === "friends");
+
+    array_slice = array.slice(-1);
+    assert(array_slice.length === 1);
+    assert(array_slice[0] === 1);
+
+    array_slice = array.slice(1, 1);
+    assert(array_slice.length === 0);
+
+    array_slice = array.slice(1, -1);
+    assert(array_slice.length === 2);
+    assert(array_slice[0] === "friends");
+    assert(array_slice[1] === "serenity");
+
+    array_slice = array.slice(2, -1);
+    assert(array_slice.length === 1);
+    assert(array_slice[0] === "serenity");
+
+    array_slice = array.slice(0, 100);
+    assert(array_slice.length === 4);
+    assert(array_slice[0] === "hello");
+    assert(array_slice[1] === "friends");
+    assert(array_slice[2] === "serenity");
+    assert(array_slice[3] === 1);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 28 - 28
Libraries/LibJS/Tests/builtins/Array/Array.prototype.some.js

@@ -1,37 +1,37 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.some.length === 1);
+    assert(Array.prototype.some.length === 1);
 
-  assertThrowsError(
-    () => {
-      [].some(undefined);
-    },
-    {
-      error: TypeError,
-      message: "undefined is not a function",
-    }
-  );
+    assertThrowsError(
+        () => {
+            [].some(undefined);
+        },
+        {
+            error: TypeError,
+            message: "undefined is not a function",
+        }
+    );
 
-  var array = ["hello", "friends", 1, 2, false, -42, { name: "serenityos" }];
+    var array = ["hello", "friends", 1, 2, false, -42, { name: "serenityos" }];
 
-  assert(array.some(value => value === "hello") === true);
-  assert(array.some(value => value === "serenity") === false);
-  assert(array.some((value, index, arr) => index === 1) === true);
-  assert(array.some(value => value == "1") === true);
-  assert(array.some(value => value === 1) === true);
-  assert(array.some(value => value === 13) === false);
-  assert(array.some(value => typeof value !== "string") === true);
-  assert(array.some(value => typeof value === "boolean") === true);
-  assert(array.some(value => value > 1) === true);
-  assert(array.some(value => value > 1 && value < 3) === true);
-  assert(array.some(value => value > 100) === false);
-  assert(array.some(value => value < 0) === true);
-  assert(array.some(value => array.pop()) === true);
-  assert(["", "hello", "friends", "serenity"].some(value => value.length === 0) === true);
-  assert([].some(value => value === 1) === false);
+    assert(array.some(value => value === "hello") === true);
+    assert(array.some(value => value === "serenity") === false);
+    assert(array.some((value, index, arr) => index === 1) === true);
+    assert(array.some(value => value == "1") === true);
+    assert(array.some(value => value === 1) === true);
+    assert(array.some(value => value === 13) === false);
+    assert(array.some(value => typeof value !== "string") === true);
+    assert(array.some(value => typeof value === "boolean") === true);
+    assert(array.some(value => value > 1) === true);
+    assert(array.some(value => value > 1 && value < 3) === true);
+    assert(array.some(value => value > 100) === false);
+    assert(array.some(value => value < 0) === true);
+    assert(array.some(value => array.pop()) === true);
+    assert(["", "hello", "friends", "serenity"].some(value => value.length === 0) === true);
+    assert([].some(value => value === 1) === false);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 72 - 72
Libraries/LibJS/Tests/builtins/Array/Array.prototype.splice.js

@@ -1,87 +1,87 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.splice.length === 2);
+    assert(Array.prototype.splice.length === 2);
 
-  var array = ["hello", "friends", "serenity", 1, 2];
-  var removed = array.splice(3);
-  assert(array.length === 3);
-  assert(array[0] === "hello");
-  assert(array[1] === "friends");
-  assert(array[2] === "serenity");
-  assert(removed.length === 2);
-  assert(removed[0] === 1);
-  assert(removed[1] === 2);
+    var array = ["hello", "friends", "serenity", 1, 2];
+    var removed = array.splice(3);
+    assert(array.length === 3);
+    assert(array[0] === "hello");
+    assert(array[1] === "friends");
+    assert(array[2] === "serenity");
+    assert(removed.length === 2);
+    assert(removed[0] === 1);
+    assert(removed[1] === 2);
 
-  array = ["hello", "friends", "serenity", 1, 2];
-  removed = array.splice(-2);
-  assert(array.length === 3);
-  assert(array[0] === "hello");
-  assert(array[1] === "friends");
-  assert(array[2] === "serenity");
-  assert(removed.length === 2);
-  assert(removed[0] === 1);
-  assert(removed[1] === 2);
+    array = ["hello", "friends", "serenity", 1, 2];
+    removed = array.splice(-2);
+    assert(array.length === 3);
+    assert(array[0] === "hello");
+    assert(array[1] === "friends");
+    assert(array[2] === "serenity");
+    assert(removed.length === 2);
+    assert(removed[0] === 1);
+    assert(removed[1] === 2);
 
-  array = ["hello", "friends", "serenity", 1, 2];
-  removed = array.splice(-2, 1);
-  assert(array.length === 4);
-  assert(array[0] === "hello");
-  assert(array[1] === "friends");
-  assert(array[2] === "serenity");
-  assert(array[3] === 2);
-  assert(removed.length === 1);
-  assert(removed[0] === 1);
+    array = ["hello", "friends", "serenity", 1, 2];
+    removed = array.splice(-2, 1);
+    assert(array.length === 4);
+    assert(array[0] === "hello");
+    assert(array[1] === "friends");
+    assert(array[2] === "serenity");
+    assert(array[3] === 2);
+    assert(removed.length === 1);
+    assert(removed[0] === 1);
 
-  array = ["serenity"];
-  removed = array.splice(0, 0, "hello", "friends");
-  assert(array.length === 3);
-  assert(array[0] === "hello");
-  assert(array[1] === "friends");
-  assert(array[2] === "serenity");
-  assert(removed.length === 0);
+    array = ["serenity"];
+    removed = array.splice(0, 0, "hello", "friends");
+    assert(array.length === 3);
+    assert(array[0] === "hello");
+    assert(array[1] === "friends");
+    assert(array[2] === "serenity");
+    assert(removed.length === 0);
 
-  array = ["goodbye", "friends", "serenity"];
-  removed = array.splice(0, 1, "hello");
-  assert(array.length === 3);
-  assert(array[0] === "hello");
-  assert(array[1] === "friends");
-  assert(array[2] === "serenity");
-  assert(removed.length === 1);
-  assert(removed[0] === "goodbye");
+    array = ["goodbye", "friends", "serenity"];
+    removed = array.splice(0, 1, "hello");
+    assert(array.length === 3);
+    assert(array[0] === "hello");
+    assert(array[1] === "friends");
+    assert(array[2] === "serenity");
+    assert(removed.length === 1);
+    assert(removed[0] === "goodbye");
 
-  array = ["foo", "bar", "baz"];
-  removed = array.splice();
-  assert(array.length === 3);
-  assert(array[0] === "foo");
-  assert(array[1] === "bar");
-  assert(array[2] === "baz");
-  assert(removed.length === 0);
+    array = ["foo", "bar", "baz"];
+    removed = array.splice();
+    assert(array.length === 3);
+    assert(array[0] === "foo");
+    assert(array[1] === "bar");
+    assert(array[2] === "baz");
+    assert(removed.length === 0);
 
-  removed = array.splice(0, 123);
-  assert(array.length === 0);
-  assert(removed.length === 3);
-  assert(removed[0] === "foo");
-  assert(removed[1] === "bar");
-  assert(removed[2] === "baz");
+    removed = array.splice(0, 123);
+    assert(array.length === 0);
+    assert(removed.length === 3);
+    assert(removed[0] === "foo");
+    assert(removed[1] === "bar");
+    assert(removed[2] === "baz");
 
-  array = ["foo", "bar", "baz"];
-  removed = array.splice(123, 123);
-  assert(array.length === 3);
-  assert(array[0] === "foo");
-  assert(array[1] === "bar");
-  assert(array[2] === "baz");
-  assert(removed.length === 0);
+    array = ["foo", "bar", "baz"];
+    removed = array.splice(123, 123);
+    assert(array.length === 3);
+    assert(array[0] === "foo");
+    assert(array[1] === "bar");
+    assert(array[2] === "baz");
+    assert(removed.length === 0);
 
-  array = ["foo", "bar", "baz"];
-  removed = array.splice(-123, 123);
-  assert(array.length === 0);
-  assert(removed.length === 3);
-  assert(removed[0] === "foo");
-  assert(removed[1] === "bar");
-  assert(removed[2] === "baz");
+    array = ["foo", "bar", "baz"];
+    removed = array.splice(-123, 123);
+    assert(array.length === 0);
+    assert(removed.length === 3);
+    assert(removed[0] === "foo");
+    assert(removed[1] === "bar");
+    assert(removed[2] === "baz");
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 16 - 16
Libraries/LibJS/Tests/builtins/Array/Array.prototype.toLocaleString.js

@@ -1,24 +1,24 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.toLocaleString.length === 0);
+    assert(Array.prototype.toLocaleString.length === 0);
 
-  assert([].toLocaleString() === "");
-  assert(["foo"].toLocaleString() === "foo");
-  assert(["foo", "bar"].toLocaleString() === "foo,bar");
-  assert(["foo", undefined, "bar", null, "baz"].toLocaleString() === "foo,,bar,,baz");
+    assert([].toLocaleString() === "");
+    assert(["foo"].toLocaleString() === "foo");
+    assert(["foo", "bar"].toLocaleString() === "foo,bar");
+    assert(["foo", undefined, "bar", null, "baz"].toLocaleString() === "foo,,bar,,baz");
 
-  var toStringCalled = 0;
-  var o = {
-    toString: () => {
-      toStringCalled++;
-      return "o";
-    },
-  };
-  assert([o, undefined, o, null, o].toLocaleString() === "o,,o,,o");
-  assert(toStringCalled === 3);
+    var toStringCalled = 0;
+    var o = {
+        toString: () => {
+            toStringCalled++;
+            return "o";
+        },
+    };
+    assert([o, undefined, o, null, o].toLocaleString() === "o,,o,,o");
+    assert(toStringCalled === 3);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 13 - 13
Libraries/LibJS/Tests/builtins/Array/Array.prototype.toString.js

@@ -1,22 +1,22 @@
 load("test-common.js");
 
 try {
-  var a = [1, 2, 3];
-  assert(a.toString() === "1,2,3");
-  assert([].toString() === "");
-  assert([5].toString() === "5");
+    var a = [1, 2, 3];
+    assert(a.toString() === "1,2,3");
+    assert([].toString() === "");
+    assert([5].toString() === "5");
 
-  assert("rgb(" + [10, 11, 12] + ")" === "rgb(10,11,12)");
+    assert("rgb(" + [10, 11, 12] + ")" === "rgb(10,11,12)");
 
-  assert([undefined, null].toString() === ",");
+    assert([undefined, null].toString() === ",");
 
-  a = new Array(5);
-  assert(a.toString() === ",,,,");
-  a[2] = "foo";
-  a[4] = "bar";
-  assert(a.toString() === ",,foo,,bar");
+    a = new Array(5);
+    assert(a.toString() === ",,,,");
+    a[2] = "foo";
+    a[4] = "bar";
+    assert(a.toString() === ",,foo,,bar");
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 21 - 21
Libraries/LibJS/Tests/builtins/Array/Array.prototype.unshift.js

@@ -1,30 +1,30 @@
 load("test-common.js");
 
 try {
-  assert(Array.prototype.unshift.length === 1);
+    assert(Array.prototype.unshift.length === 1);
 
-  var a = ["hello"];
-  var length = a.unshift();
-  assert(length === 1);
-  assert(a.length === 1);
-  assert(a[0] === "hello");
+    var a = ["hello"];
+    var length = a.unshift();
+    assert(length === 1);
+    assert(a.length === 1);
+    assert(a[0] === "hello");
 
-  length = a.unshift("friends");
-  assert(length === 2);
-  assert(a.length === 2);
-  assert(a[0] === "friends");
-  assert(a[1] === "hello");
+    length = a.unshift("friends");
+    assert(length === 2);
+    assert(a.length === 2);
+    assert(a[0] === "friends");
+    assert(a[1] === "hello");
 
-  length = a.unshift(1, 2, 3);
-  assert(length === 5);
-  assert(a.length === 5);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-  assert(a[3] === "friends");
-  assert(a[4] === "hello");
+    length = a.unshift(1, 2, 3);
+    assert(length === 5);
+    assert(a.length === 5);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+    assert(a[3] === "friends");
+    assert(a[4] === "hello");
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 58 - 58
Libraries/LibJS/Tests/builtins/Array/array-basic.js

@@ -1,63 +1,63 @@
 load("test-common.js");
 
 try {
-  var a = [1, 2, 3];
-
-  assert(typeof a === "object");
-  assert(a.length === 3);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-
-  a[1] = 5;
-  assert(a[1] === 5);
-  assert(a.length === 3);
-
-  a.push(7);
-  assert(a[3] === 7);
-  assert(a.length === 4);
-
-  a = [,];
-  assert(a.length === 1);
-  assert(a.toString() === "");
-  assert(a[0] === undefined);
-
-  a = [, , , ,];
-  assert(a.length === 4);
-  assert(a.toString() === ",,,");
-  assert(a[0] === undefined);
-  assert(a[1] === undefined);
-  assert(a[2] === undefined);
-  assert(a[3] === undefined);
-
-  a = [1, , 2, , , 3];
-  assert(a.length === 6);
-  assert(a.toString() === "1,,2,,,3");
-  assert(a[0] === 1);
-  assert(a[1] === undefined);
-  assert(a[2] === 2);
-  assert(a[3] === undefined);
-  assert(a[4] === undefined);
-  assert(a[5] === 3);
-
-  a = [1, , 2, , , 3];
-  Object.defineProperty(a, 1, {
-    get() {
-      return this.secret_prop;
-    },
-    set(value) {
-      this.secret_prop = value;
-    },
-  });
-  assert(a.length === 6);
-  assert(a.toString() === "1,,2,,,3");
-  assert(a.secret_prop === undefined);
-  a[1] = 20;
-  assert(a.length === 6);
-  assert(a.toString() === "1,20,2,,,3");
-  assert(a.secret_prop === 20);
-
-  console.log("PASS");
+    var a = [1, 2, 3];
+
+    assert(typeof a === "object");
+    assert(a.length === 3);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+
+    a[1] = 5;
+    assert(a[1] === 5);
+    assert(a.length === 3);
+
+    a.push(7);
+    assert(a[3] === 7);
+    assert(a.length === 4);
+
+    a = [,];
+    assert(a.length === 1);
+    assert(a.toString() === "");
+    assert(a[0] === undefined);
+
+    a = [, , , ,];
+    assert(a.length === 4);
+    assert(a.toString() === ",,,");
+    assert(a[0] === undefined);
+    assert(a[1] === undefined);
+    assert(a[2] === undefined);
+    assert(a[3] === undefined);
+
+    a = [1, , 2, , , 3];
+    assert(a.length === 6);
+    assert(a.toString() === "1,,2,,,3");
+    assert(a[0] === 1);
+    assert(a[1] === undefined);
+    assert(a[2] === 2);
+    assert(a[3] === undefined);
+    assert(a[4] === undefined);
+    assert(a[5] === 3);
+
+    a = [1, , 2, , , 3];
+    Object.defineProperty(a, 1, {
+        get() {
+            return this.secret_prop;
+        },
+        set(value) {
+            this.secret_prop = value;
+        },
+    });
+    assert(a.length === 6);
+    assert(a.toString() === "1,,2,,,3");
+    assert(a.secret_prop === undefined);
+    a[1] = 20;
+    assert(a.length === 6);
+    assert(a.toString() === "1,20,2,,,3");
+    assert(a.secret_prop === 20);
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 44 - 44
Libraries/LibJS/Tests/builtins/Array/array-length-setter.js

@@ -1,51 +1,51 @@
 load("test-common.js");
 
 try {
-  var a = [1, 2, 3];
-
-  assert(a.length === 3);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-
-  a.length = 5;
-  assert(a.length === 5);
-  assert(a[0] === 1);
-  assert(a[1] === 2);
-  assert(a[2] === 3);
-  assert(a[3] === undefined);
-  assert(a[4] === undefined);
-
-  a.length = 1;
-  assert(a.length === 1);
-  assert(a[0] === 1);
-
-  a.length = 0;
-  assert(a.length === 0);
-
-  a.length = "42";
-  assert(a.length === 42);
-
-  a.length = [];
-  assert(a.length === 0);
-
-  a.length = true;
-  assert(a.length === 1);
-
-  [undefined, "foo", -1, Infinity, -Infinity, NaN].forEach(value => {
-    assertThrowsError(
-      () => {
-        a.length = value;
-      },
-      {
-        error: RangeError,
-        message: "Invalid array length",
-      }
-    );
+    var a = [1, 2, 3];
+
+    assert(a.length === 3);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+
+    a.length = 5;
+    assert(a.length === 5);
+    assert(a[0] === 1);
+    assert(a[1] === 2);
+    assert(a[2] === 3);
+    assert(a[3] === undefined);
+    assert(a[4] === undefined);
+
+    a.length = 1;
     assert(a.length === 1);
-  });
+    assert(a[0] === 1);
 
-  console.log("PASS");
+    a.length = 0;
+    assert(a.length === 0);
+
+    a.length = "42";
+    assert(a.length === 42);
+
+    a.length = [];
+    assert(a.length === 0);
+
+    a.length = true;
+    assert(a.length === 1);
+
+    [undefined, "foo", -1, Infinity, -Infinity, NaN].forEach(value => {
+        assertThrowsError(
+            () => {
+                a.length = value;
+            },
+            {
+                error: RangeError,
+                message: "Invalid array length",
+            }
+        );
+        assert(a.length === 1);
+    });
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 17 - 17
Libraries/LibJS/Tests/builtins/Array/array-shrink-during-find-crash.js

@@ -1,25 +1,25 @@
 load("test-common.js");
 
 try {
-  var a, callbackCalled;
+    var a, callbackCalled;
 
-  callbackCalled = 0;
-  a = [1, 2, 3, 4, 5];
-  a.find(() => {
-    callbackCalled++;
-    a.pop();
-  });
-  assert(callbackCalled === 5);
+    callbackCalled = 0;
+    a = [1, 2, 3, 4, 5];
+    a.find(() => {
+        callbackCalled++;
+        a.pop();
+    });
+    assert(callbackCalled === 5);
 
-  callbackCalled = 0;
-  a = [1, 2, 3, 4, 5];
-  a.findIndex(() => {
-    callbackCalled++;
-    a.pop();
-  });
-  assert(callbackCalled === 5);
+    callbackCalled = 0;
+    a = [1, 2, 3, 4, 5];
+    a.findIndex(() => {
+        callbackCalled++;
+        a.pop();
+    });
+    assert(callbackCalled === 5);
 
-  console.log("PASS");
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 37 - 37
Libraries/LibJS/Tests/builtins/Array/array-spread.js

@@ -1,45 +1,45 @@
 load("test-common.js");
 
 function testArray(arr) {
-  return arr.length === 4 && arr[0] === 0 && arr[1] === 1 && arr[2] === 2 && arr[3] === 3;
+    return arr.length === 4 && arr[0] === 0 && arr[1] === 1 && arr[2] === 2 && arr[3] === 3;
 }
 
 try {
-  let arr = [0, ...[1, 2], 3];
-  assert(testArray(arr));
-
-  let a = [1, 2];
-  arr = [0, ...a, 3];
-  assert(testArray(arr));
-
-  let obj = { a: [1, 2] };
-  arr = [0, ...obj.a, 3];
-  assert(testArray(arr));
-
-  arr = [...[], ...[...[0, 1, 2]], 3];
-  assert(testArray(arr));
-
-  assertThrowsError(
-    () => {
-      [...1];
-    },
-    {
-      error: TypeError,
-      message: "1 is not iterable",
-    }
-  );
-
-  assertThrowsError(
-    () => {
-      [...{}];
-    },
-    {
-      error: TypeError,
-      message: "[object Object] is not iterable",
-    }
-  );
-
-  console.log("PASS");
+    let arr = [0, ...[1, 2], 3];
+    assert(testArray(arr));
+
+    let a = [1, 2];
+    arr = [0, ...a, 3];
+    assert(testArray(arr));
+
+    let obj = { a: [1, 2] };
+    arr = [0, ...obj.a, 3];
+    assert(testArray(arr));
+
+    arr = [...[], ...[...[0, 1, 2]], 3];
+    assert(testArray(arr));
+
+    assertThrowsError(
+        () => {
+            [...1];
+        },
+        {
+            error: TypeError,
+            message: "1 is not iterable",
+        }
+    );
+
+    assertThrowsError(
+        () => {
+            [...{}];
+        },
+        {
+            error: TypeError,
+            message: "[object Object] is not iterable",
+        }
+    );
+
+    console.log("PASS");
 } catch (e) {
-  console.log("FAIL: " + e);
+    console.log("FAIL: " + e);
 }

+ 53 - 53
Libraries/LibJS/Tests/builtins/BigInt/BigInt.js

@@ -1,68 +1,68 @@
 describe("correct behavior", () => {
-  test("basic functionality", () => {
-    expect(BigInt).toHaveLength(1);
-    expect(BigInt.name).toBe("BigInt");
-  });
+    test("basic functionality", () => {
+        expect(BigInt).toHaveLength(1);
+        expect(BigInt.name).toBe("BigInt");
+    });
 
-  test("constructor with numbers", () => {
-    expect(BigInt(0)).toBe(0n);
-    expect(BigInt(1)).toBe(1n);
-    expect(BigInt(+1)).toBe(1n);
-    expect(BigInt(-1)).toBe(-1n);
-    expect(BigInt(123n)).toBe(123n);
-  });
+    test("constructor with numbers", () => {
+        expect(BigInt(0)).toBe(0n);
+        expect(BigInt(1)).toBe(1n);
+        expect(BigInt(+1)).toBe(1n);
+        expect(BigInt(-1)).toBe(-1n);
+        expect(BigInt(123n)).toBe(123n);
+    });
 
-  test("constructor with strings", () => {
-    expect(BigInt("")).toBe(0n);
-    expect(BigInt("0")).toBe(0n);
-    expect(BigInt("1")).toBe(1n);
-    expect(BigInt("+1")).toBe(1n);
-    expect(BigInt("-1")).toBe(-1n);
-    expect(BigInt("-1")).toBe(-1n);
-    expect(BigInt("42")).toBe(42n);
-    expect(BigInt("  \n  00100  \n  ")).toBe(100n);
-    expect(BigInt("3323214327642987348732109829832143298746432437532197321")).toBe(
-      3323214327642987348732109829832143298746432437532197321n
-    );
-  });
+    test("constructor with strings", () => {
+        expect(BigInt("")).toBe(0n);
+        expect(BigInt("0")).toBe(0n);
+        expect(BigInt("1")).toBe(1n);
+        expect(BigInt("+1")).toBe(1n);
+        expect(BigInt("-1")).toBe(-1n);
+        expect(BigInt("-1")).toBe(-1n);
+        expect(BigInt("42")).toBe(42n);
+        expect(BigInt("  \n  00100  \n  ")).toBe(100n);
+        expect(BigInt("3323214327642987348732109829832143298746432437532197321")).toBe(
+            3323214327642987348732109829832143298746432437532197321n
+        );
+    });
 
-  test("constructor with objects", () => {
-    expect(BigInt([])).toBe(0n);
-  });
+    test("constructor with objects", () => {
+        expect(BigInt([])).toBe(0n);
+    });
 });
 
 describe("errors", () => {
-  test('cannot be constructed with "new"', () => {
-    expect(() => {
-      new BigInt();
-    }).toThrowWithMessage(TypeError, "BigInt is not a constructor");
-  });
+    test('cannot be constructed with "new"', () => {
+        expect(() => {
+            new BigInt();
+        }).toThrowWithMessage(TypeError, "BigInt is not a constructor");
+    });
 
-  test("invalid arguments", () => {
-    expect(() => {
-      BigInt(null);
-    }).toThrowWithMessage(TypeError, "Cannot convert null to BigInt");
+    test("invalid arguments", () => {
+        expect(() => {
+            BigInt(null);
+        }).toThrowWithMessage(TypeError, "Cannot convert null to BigInt");
 
-    expect(() => {
-      BigInt(undefined);
-    }).toThrowWithMessage(TypeError, "Cannot convert undefined to BigInt");
+        expect(() => {
+            BigInt(undefined);
+        }).toThrowWithMessage(TypeError, "Cannot convert undefined to BigInt");
 
-    expect(() => {
-      BigInt(Symbol());
-    }).toThrowWithMessage(TypeError, "Cannot convert symbol to BigInt");
+        expect(() => {
+            BigInt(Symbol());
+        }).toThrowWithMessage(TypeError, "Cannot convert symbol to BigInt");
 
-    ["foo", "123n", "1+1", {}, function () {}].forEach(value => {
-      expect(() => {
-        BigInt(value);
-      }).toThrowWithMessage(SyntaxError, `Invalid value for BigInt: ${value}`);
+        ["foo", "123n", "1+1", {}, function () {}].forEach(value => {
+            expect(() => {
+                BigInt(value);
+            }).toThrowWithMessage(SyntaxError, `Invalid value for BigInt: ${value}`);
+        });
     });
-  });
 
-  test("invalid numeric arguments", () => {
-    [1.23, Infinity, -Infinity, NaN].forEach(value => {
-      expect(() => {
-        BigInt(value);
-      }).toThrowWithMessage(RangeError, "BigInt argument must be an integer");
+    test("invalid numeric arguments", () => {
+        [1.23, Infinity, -Infinity, NaN].forEach(value => {
+            expect(() => {
+                BigInt(value);
+            }).toThrowWithMessage(RangeError, "BigInt argument must be an integer");
+        });
     });
-  });
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toLocaleString.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  expect(BigInt.prototype.toLocaleString).toHaveLength(0);
-  expect(BigInt(123).toLocaleString()).toBe("123");
+    expect(BigInt.prototype.toLocaleString).toHaveLength(0);
+    expect(BigInt(123).toLocaleString()).toBe("123");
 });
 
 test("calling with non-BigInt |this|", () => {
-  expect(() => {
-    BigInt.prototype.toLocaleString.call("foo");
-  }).toThrowWithMessage(TypeError, "Not a BigInt object");
+    expect(() => {
+        BigInt.prototype.toLocaleString.call("foo");
+    }).toThrowWithMessage(TypeError, "Not a BigInt object");
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.toString.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  expect(BigInt.prototype.toString).toHaveLength(0);
-  expect(BigInt(123).toString()).toBe("123");
+    expect(BigInt.prototype.toString).toHaveLength(0);
+    expect(BigInt(123).toString()).toBe("123");
 });
 
 test("calling with non-BigInt |this|", () => {
-  expect(() => {
-    BigInt.prototype.toString.call("foo");
-  }).toThrowWithMessage(TypeError, "Not a BigInt object");
+    expect(() => {
+        BigInt.prototype.toString.call("foo");
+    }).toThrowWithMessage(TypeError, "Not a BigInt object");
 });

+ 7 - 7
Libraries/LibJS/Tests/builtins/BigInt/BigInt.prototype.valueOf.js

@@ -1,12 +1,12 @@
 test("basic functionality", () => {
-  expect(BigInt.prototype.valueOf).toHaveLength(0);
-  expect(typeof BigInt(123).valueOf()).toBe("bigint");
-  // FIXME: Uncomment once we support Object() with argument
-  // expect(typeof Object(123n).valueOf()).toBe("bigint");
+    expect(BigInt.prototype.valueOf).toHaveLength(0);
+    expect(typeof BigInt(123).valueOf()).toBe("bigint");
+    // FIXME: Uncomment once we support Object() with argument
+    // expect(typeof Object(123n).valueOf()).toBe("bigint");
 });
 
 test("calling with non-BigInt |this|", () => {
-  expect(() => {
-    BigInt.prototype.valueOf.call("foo");
-  }).toThrowWithMessage(TypeError, "Not a BigInt object");
+    expect(() => {
+        BigInt.prototype.valueOf.call("foo");
+    }).toThrowWithMessage(TypeError, "Not a BigInt object");
 });

+ 66 - 66
Libraries/LibJS/Tests/builtins/BigInt/bigint-basic.js

@@ -1,80 +1,80 @@
 describe("correct behavior", () => {
-  test("typeof bigint", () => {
-    expect(typeof 1n).toBe("bigint");
-  });
+    test("typeof bigint", () => {
+        expect(typeof 1n).toBe("bigint");
+    });
 
-  test("bigint string coersion", () => {
-    expect("" + 123n).toBe("123");
-  });
+    test("bigint string coersion", () => {
+        expect("" + 123n).toBe("123");
+    });
 
-  test("arithmetic operators", () => {
-    let bigint = 123n;
-    expect(-bigint).toBe(-123n);
+    test("arithmetic operators", () => {
+        let bigint = 123n;
+        expect(-bigint).toBe(-123n);
 
-    expect(12n + 34n).toBe(46n);
-    expect(12n - 34n).toBe(-22n);
-    expect(8n * 12n).toBe(96n);
-    expect(123n / 10n).toBe(12n);
-    expect(2n ** 3n).toBe(8n);
-    expect(5n % 3n).toBe(2n);
-    expect(
-      45977665298704210987n +
-        (714320987142450987412098743217984576n / 4598741987421098765327980n) * 987498743n
-    ).toBe(199365500239020623962n);
-  });
+        expect(12n + 34n).toBe(46n);
+        expect(12n - 34n).toBe(-22n);
+        expect(8n * 12n).toBe(96n);
+        expect(123n / 10n).toBe(12n);
+        expect(2n ** 3n).toBe(8n);
+        expect(5n % 3n).toBe(2n);
+        expect(
+            45977665298704210987n +
+                (714320987142450987412098743217984576n / 4598741987421098765327980n) * 987498743n
+        ).toBe(199365500239020623962n);
+    });
 
-  test("bitwise operators", () => {
-    expect(12n & 5n).toBe(4n);
-    expect(1n | 2n).toBe(3n);
-    expect(5n ^ 3n).toBe(6n);
-    expect(~1n).toBe(-2n);
-  });
+    test("bitwise operators", () => {
+        expect(12n & 5n).toBe(4n);
+        expect(1n | 2n).toBe(3n);
+        expect(5n ^ 3n).toBe(6n);
+        expect(~1n).toBe(-2n);
+    });
 
-  test("increment operators", () => {
-    let bigint = 1n;
-    expect(bigint++).toBe(1n);
-    expect(bigint).toBe(2n);
-    expect(bigint--).toBe(2n);
-    expect(bigint).toBe(1n);
-    expect(++bigint).toBe(2n);
-    expect(bigint).toBe(2n);
-    expect(--bigint).toBe(1n);
-    expect(bigint).toBe(1n);
-  });
+    test("increment operators", () => {
+        let bigint = 1n;
+        expect(bigint++).toBe(1n);
+        expect(bigint).toBe(2n);
+        expect(bigint--).toBe(2n);
+        expect(bigint).toBe(1n);
+        expect(++bigint).toBe(2n);
+        expect(bigint).toBe(2n);
+        expect(--bigint).toBe(1n);
+        expect(bigint).toBe(1n);
+    });
 
-  test("weak equality operators", () => {
-    expect(1n == 1n).toBeTrue();
-    expect(1n == 1).toBeTrue();
-    expect(1 == 1n).toBeTrue();
-    expect(1n == 1.23).toBeFalse();
-    expect(1.23 == 1n).toBeFalse();
+    test("weak equality operators", () => {
+        expect(1n == 1n).toBeTrue();
+        expect(1n == 1).toBeTrue();
+        expect(1 == 1n).toBeTrue();
+        expect(1n == 1.23).toBeFalse();
+        expect(1.23 == 1n).toBeFalse();
 
-    expect(1n != 1n).toBeFalse();
-    expect(1n != 1).toBeFalse();
-    expect(1 != 1n).toBeFalse();
-    expect(1n != 1.23).toBeTrue();
-    expect(1.23 != 1n).toBeTrue();
-  });
+        expect(1n != 1n).toBeFalse();
+        expect(1n != 1).toBeFalse();
+        expect(1 != 1n).toBeFalse();
+        expect(1n != 1.23).toBeTrue();
+        expect(1.23 != 1n).toBeTrue();
+    });
 
-  test("strong equality operators", () => {
-    expect(1n === 1n).toBeTrue();
-    expect(1n === 1).toBeFalse();
-    expect(1 === 1n).toBeFalse();
-    expect(1n === 1.23).toBeFalse();
-    expect(1.23 === 1n).toBeFalse();
+    test("strong equality operators", () => {
+        expect(1n === 1n).toBeTrue();
+        expect(1n === 1).toBeFalse();
+        expect(1 === 1n).toBeFalse();
+        expect(1n === 1.23).toBeFalse();
+        expect(1.23 === 1n).toBeFalse();
 
-    expect(1n !== 1n).toBeFalse();
-    expect(1n !== 1).toBeTrue();
-    expect(1 !== 1n).toBeTrue();
-    expect(1n !== 1.23).toBeTrue();
-    expect(1.23 !== 1n).toBeTrue();
-  });
+        expect(1n !== 1n).toBeFalse();
+        expect(1n !== 1).toBeTrue();
+        expect(1 !== 1n).toBeTrue();
+        expect(1n !== 1.23).toBeTrue();
+        expect(1.23 !== 1n).toBeTrue();
+    });
 });
 
 describe("errors", () => {
-  test("conversion to number", () => {
-    expect(() => {
-      +123n;
-    }).toThrowWithMessage(TypeError, "Cannot convert BigInt to number");
-  });
+    test("conversion to number", () => {
+        expect(() => {
+            +123n;
+        }).toThrowWithMessage(TypeError, "Cannot convert BigInt to number");
+    });
 });

+ 24 - 24
Libraries/LibJS/Tests/builtins/BigInt/bigint-number-mix-errors.js

@@ -1,31 +1,31 @@
 const doTest = (operatorName, executeOperation) => {
-  [1, null, undefined].forEach(value => {
-    const messageSuffix = operatorName === "unsigned right-shift" ? "" : " and other type";
+    [1, null, undefined].forEach(value => {
+        const messageSuffix = operatorName === "unsigned right-shift" ? "" : " and other type";
 
-    expect(() => {
-      executeOperation(1n, value);
-    }).toThrowWithMessage(
-      TypeError,
-      `Cannot use ${operatorName} operator with BigInt${messageSuffix}`
-    );
-  });
+        expect(() => {
+            executeOperation(1n, value);
+        }).toThrowWithMessage(
+            TypeError,
+            `Cannot use ${operatorName} operator with BigInt${messageSuffix}`
+        );
+    });
 };
 
 [
-  ["addition", (a, b) => a + b],
-  ["subtraction", (a, b) => a - b],
-  ["multiplication", (a, b) => a * b],
-  ["division", (a, b) => a / b],
-  ["modulo", (a, b) => a % b],
-  ["exponentiation", (a, b) => a ** b],
-  ["bitwise OR", (a, b) => a | b],
-  ["bitwise AND", (a, b) => a & b],
-  ["bitwise XOR", (a, b) => a ^ b],
-  ["left-shift", (a, b) => a << b],
-  ["right-shift", (a, b) => a >> b],
-  ["unsigned right-shift", (a, b) => a >>> b],
+    ["addition", (a, b) => a + b],
+    ["subtraction", (a, b) => a - b],
+    ["multiplication", (a, b) => a * b],
+    ["division", (a, b) => a / b],
+    ["modulo", (a, b) => a % b],
+    ["exponentiation", (a, b) => a ** b],
+    ["bitwise OR", (a, b) => a | b],
+    ["bitwise AND", (a, b) => a & b],
+    ["bitwise XOR", (a, b) => a ^ b],
+    ["left-shift", (a, b) => a << b],
+    ["right-shift", (a, b) => a >> b],
+    ["unsigned right-shift", (a, b) => a >>> b],
 ].forEach(testCase => {
-  test(`using ${testCase[0]} operator with BigInt and other type`, () => {
-    doTest(testCase[0], testCase[1]);
-  });
+    test(`using ${testCase[0]} operator with BigInt and other type`, () => {
+        doTest(testCase[0], testCase[1]);
+    });
 });

+ 22 - 22
Libraries/LibJS/Tests/builtins/Boolean/Boolean.js

@@ -1,32 +1,32 @@
 test("constructor properties", () => {
-  expect(Boolean).toHaveLength(1);
-  expect(Boolean.name).toBe("Boolean");
+    expect(Boolean).toHaveLength(1);
+    expect(Boolean.name).toBe("Boolean");
 });
 
 test("typeof", () => {
-  expect(typeof new Boolean()).toBe("object");
-  expect(typeof Boolean()).toBe("boolean");
-  expect(typeof Boolean(true)).toBe("boolean");
+    expect(typeof new Boolean()).toBe("object");
+    expect(typeof Boolean()).toBe("boolean");
+    expect(typeof Boolean(true)).toBe("boolean");
 });
 
 test("basic functionality", () => {
-  var foo = new Boolean(true);
-  var bar = new Boolean(true);
+    var foo = new Boolean(true);
+    var bar = new Boolean(true);
 
-  expect(foo).not.toBe(bar);
-  expect(foo.valueOf()).toBe(bar.valueOf());
+    expect(foo).not.toBe(bar);
+    expect(foo.valueOf()).toBe(bar.valueOf());
 
-  expect(Boolean()).toBeFalse();
-  expect(Boolean(false)).toBeFalse();
-  expect(Boolean(null)).toBeFalse();
-  expect(Boolean(undefined)).toBeFalse();
-  expect(Boolean(NaN)).toBeFalse();
-  expect(Boolean("")).toBeFalse();
-  expect(Boolean(0.0)).toBeFalse();
-  expect(Boolean(-0.0)).toBeFalse();
-  expect(Boolean(true)).toBeTrue();
-  expect(Boolean("0")).toBeTrue();
-  expect(Boolean({})).toBeTrue();
-  expect(Boolean([])).toBeTrue();
-  expect(Boolean(1)).toBeTrue();
+    expect(Boolean()).toBeFalse();
+    expect(Boolean(false)).toBeFalse();
+    expect(Boolean(null)).toBeFalse();
+    expect(Boolean(undefined)).toBeFalse();
+    expect(Boolean(NaN)).toBeFalse();
+    expect(Boolean("")).toBeFalse();
+    expect(Boolean(0.0)).toBeFalse();
+    expect(Boolean(-0.0)).toBeFalse();
+    expect(Boolean(true)).toBeTrue();
+    expect(Boolean("0")).toBeTrue();
+    expect(Boolean({})).toBeTrue();
+    expect(Boolean([])).toBeTrue();
+    expect(Boolean(1)).toBeTrue();
 });

+ 3 - 3
Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js

@@ -1,5 +1,5 @@
 test("basic functionality", () => {
-  expect(typeof Boolean.prototype).toBe("object");
-  expect(Boolean.prototype.valueOf()).toBeFalse();
-  expect(Boolean.prototype).not.toHaveProperty("length");
+    expect(typeof Boolean.prototype).toBe("object");
+    expect(Boolean.prototype.valueOf()).toBeFalse();
+    expect(Boolean.prototype).not.toHaveProperty("length");
 });

+ 10 - 10
Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.toString.js

@@ -1,17 +1,17 @@
 test("basic functionality", () => {
-  var foo = true;
-  expect(foo.toString()).toBe("true");
-  expect(true.toString()).toBe("true");
+    var foo = true;
+    expect(foo.toString()).toBe("true");
+    expect(true.toString()).toBe("true");
 
-  expect(Boolean.prototype.toString.call(true)).toBe("true");
-  expect(Boolean.prototype.toString.call(false)).toBe("false");
+    expect(Boolean.prototype.toString.call(true)).toBe("true");
+    expect(Boolean.prototype.toString.call(false)).toBe("false");
 
-  expect(new Boolean(true).toString()).toBe("true");
-  expect(new Boolean(false).toString()).toBe("false");
+    expect(new Boolean(true).toString()).toBe("true");
+    expect(new Boolean(false).toString()).toBe("false");
 });
 
 test("errors on non-boolean |this|", () => {
-  expect(() => {
-    Boolean.prototype.toString.call("foo");
-  }).toThrowWithMessage(TypeError, "Not a Boolean object");
+    expect(() => {
+        Boolean.prototype.toString.call("foo");
+    }).toThrowWithMessage(TypeError, "Not a Boolean object");
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.valueOf.js

@@ -1,16 +1,16 @@
 test("basic functionality", () => {
-  var foo = true;
-  expect(foo.valueOf()).toBeTrue();
-  expect(true.valueOf()).toBeTrue();
+    var foo = true;
+    expect(foo.valueOf()).toBeTrue();
+    expect(true.valueOf()).toBeTrue();
 
-  expect(Boolean.prototype.valueOf.call(true)).toBeTrue();
-  expect(Boolean.prototype.valueOf.call(false)).toBeFalse();
+    expect(Boolean.prototype.valueOf.call(true)).toBeTrue();
+    expect(Boolean.prototype.valueOf.call(false)).toBeFalse();
 
-  expect(new Boolean().valueOf()).toBeFalse();
+    expect(new Boolean().valueOf()).toBeFalse();
 });
 
 test("errors on non-boolean |this|", () => {
-  expect(() => {
-    Boolean.prototype.valueOf.call("foo");
-  }).toThrowWithMessage(TypeError, "Not a Boolean object");
+    expect(() => {
+        Boolean.prototype.valueOf.call("foo");
+    }).toThrowWithMessage(TypeError, "Not a Boolean object");
 });

+ 3 - 3
Libraries/LibJS/Tests/builtins/Date/Date.js

@@ -1,5 +1,5 @@
 test("basic functionality", () => {
-  expect(Date).toHaveLength(7);
-  expect(Date.name === "Date");
-  expect(Date.prototype).not.toHaveProperty("length");
+    expect(Date).toHaveLength(7);
+    expect(Date.name === "Date");
+    expect(Date.prototype).not.toHaveProperty("length");
 });

+ 8 - 8
Libraries/LibJS/Tests/builtins/Date/Date.now.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  var last = 0;
-  for (var i = 0; i < 100; ++i) {
-    var now = Date.now();
-    expect(now).not.toBeNaN();
-    expect(now).toBeGreaterThan(1580000000000);
-    expect(now).toBeGreaterThanOrEqual(last);
-    last = now;
-  }
+    var last = 0;
+    for (var i = 0; i < 100; ++i) {
+        var now = Date.now();
+        expect(now).not.toBeNaN();
+        expect(now).toBeGreaterThan(1580000000000);
+        expect(now).toBeGreaterThanOrEqual(last);
+        last = now;
+    }
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDate.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  let d = new Date();
-  expect(d.getDate()).toBe(d.getDate());
-  expect(d.getDate()).not.toBeNaN();
-  expect(d.getDate()).toBeGreaterThanOrEqual(1);
-  expect(d.getDate()).toBeLessThanOrEqual(31);
+    let d = new Date();
+    expect(d.getDate()).toBe(d.getDate());
+    expect(d.getDate()).not.toBeNaN();
+    expect(d.getDate()).toBeGreaterThanOrEqual(1);
+    expect(d.getDate()).toBeLessThanOrEqual(31);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getDay.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getDay()).toBe(d.getDay());
-  expect(d.getDay()).not.toBeNaN();
-  expect(d.getDay()).toBeGreaterThanOrEqual(0);
-  expect(d.getDay()).toBeLessThanOrEqual(6);
+    var d = new Date();
+    expect(d.getDay()).toBe(d.getDay());
+    expect(d.getDay()).not.toBeNaN();
+    expect(d.getDay()).toBeGreaterThanOrEqual(0);
+    expect(d.getDay()).toBeLessThanOrEqual(6);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getFullYear.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getFullYear()).toBe(d.getFullYear());
-  expect(d.getFullYear()).not.toBeNaN();
-  expect(d.getFullYear()).toBe(d.getFullYear());
-  expect(d.getFullYear()).toBeGreaterThanOrEqual(2020);
+    var d = new Date();
+    expect(d.getFullYear()).toBe(d.getFullYear());
+    expect(d.getFullYear()).not.toBeNaN();
+    expect(d.getFullYear()).toBe(d.getFullYear());
+    expect(d.getFullYear()).toBeGreaterThanOrEqual(2020);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getHours.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getHours()).toBe(d.getHours());
-  expect(d.getHours()).not.toBeNaN();
-  expect(d.getHours()).toBeGreaterThanOrEqual(0);
-  expect(d.getHours()).toBeLessThanOrEqual(23);
+    var d = new Date();
+    expect(d.getHours()).toBe(d.getHours());
+    expect(d.getHours()).not.toBeNaN();
+    expect(d.getHours()).toBeGreaterThanOrEqual(0);
+    expect(d.getHours()).toBeLessThanOrEqual(23);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMilliseconds.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getMilliseconds()).toBe(d.getMilliseconds());
-  expect(d.getMilliseconds()).not.toBeNaN();
-  expect(d.getMilliseconds()).toBeGreaterThanOrEqual(0);
-  expect(d.getMilliseconds()).toBeLessThanOrEqual(999);
+    var d = new Date();
+    expect(d.getMilliseconds()).toBe(d.getMilliseconds());
+    expect(d.getMilliseconds()).not.toBeNaN();
+    expect(d.getMilliseconds()).toBeGreaterThanOrEqual(0);
+    expect(d.getMilliseconds()).toBeLessThanOrEqual(999);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMinutes.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getMinutes()).toBe(d.getMinutes());
-  expect(d.getMinutes()).not.toBeNaN();
-  expect(d.getMinutes()).toBeGreaterThanOrEqual(0);
-  expect(d.getMinutes()).toBeLessThanOrEqual(59);
+    var d = new Date();
+    expect(d.getMinutes()).toBe(d.getMinutes());
+    expect(d.getMinutes()).not.toBeNaN();
+    expect(d.getMinutes()).toBeGreaterThanOrEqual(0);
+    expect(d.getMinutes()).toBeLessThanOrEqual(59);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getMonth.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getMonth()).toBe(d.getMonth());
-  expect(d.getMonth()).not.toBeNaN();
-  expect(d.getMonth()).toBeGreaterThanOrEqual(0);
-  expect(d.getMonth()).toBeLessThanOrEqual(11);
+    var d = new Date();
+    expect(d.getMonth()).toBe(d.getMonth());
+    expect(d.getMonth()).not.toBeNaN();
+    expect(d.getMonth()).toBeGreaterThanOrEqual(0);
+    expect(d.getMonth()).toBeLessThanOrEqual(11);
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getSeconds.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getSeconds()).toBe(d.getSeconds());
-  expect(d.getSeconds()).not.toBeNaN();
-  expect(d.getSeconds()).toBeGreaterThanOrEqual(0);
-  expect(d.getSeconds()).toBeLessThanOrEqual(59);
+    var d = new Date();
+    expect(d.getSeconds()).toBe(d.getSeconds());
+    expect(d.getSeconds()).not.toBeNaN();
+    expect(d.getSeconds()).toBeGreaterThanOrEqual(0);
+    expect(d.getSeconds()).toBeLessThanOrEqual(59);
 });

+ 4 - 4
Libraries/LibJS/Tests/builtins/Date/Date.prototype.getTime.js

@@ -1,6 +1,6 @@
 test("basic functionality", () => {
-  var d = new Date();
-  expect(d.getTime()).toBe(d.getTime());
-  expect(d.getTime()).not.toBeNaN();
-  expect(d.getTime()).toBeGreaterThanOrEqual(1580000000000);
+    var d = new Date();
+    expect(d.getTime()).toBe(d.getTime());
+    expect(d.getTime()).not.toBeNaN();
+    expect(d.getTime()).toBeGreaterThanOrEqual(1580000000000);
 });

+ 10 - 10
Libraries/LibJS/Tests/builtins/Error/Error.js

@@ -1,18 +1,18 @@
 test("basic functionality", () => {
-  expect(Error).toHaveLength(1);
-  expect(Error.name).toBe("Error");
+    expect(Error).toHaveLength(1);
+    expect(Error.name).toBe("Error");
 });
 
 test("name", () => {
-  [Error(), Error(undefined), Error("test"), Error(42), Error(null)].forEach(error => {
-    expect(error.name).toBe("Error");
-  });
+    [Error(), Error(undefined), Error("test"), Error(42), Error(null)].forEach(error => {
+        expect(error.name).toBe("Error");
+    });
 });
 
 test("message", () => {
-  expect(Error().message).toBe("");
-  expect(Error(undefined).message).toBe("");
-  expect(Error("test").message).toBe("test");
-  expect(Error(42).message).toBe("42");
-  expect(Error(null).message).toBe("null");
+    expect(Error().message).toBe("");
+    expect(Error(undefined).message).toBe("");
+    expect(Error("test").message).toBe("test");
+    expect(Error(42).message).toBe("42");
+    expect(Error(null).message).toBe("null");
 });

+ 6 - 6
Libraries/LibJS/Tests/builtins/Error/Error.prototype.name.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  expect(Error.prototype).not.toHaveProperty("length");
+    expect(Error.prototype).not.toHaveProperty("length");
 
-  var changedInstance = new Error("");
-  changedInstance.name = "NewCustomError";
-  expect(changedInstance.name).toBe("NewCustomError");
+    var changedInstance = new Error("");
+    changedInstance.name = "NewCustomError";
+    expect(changedInstance.name).toBe("NewCustomError");
 
-  var normalInstance = new Error("");
-  expect(normalInstance.name).toBe("Error");
+    var normalInstance = new Error("");
+    expect(normalInstance.name).toBe("Error");
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Error/Error.prototype.toString.js

@@ -1,7 +1,7 @@
 test("basic functionality", () => {
-  expect(Error().toString()).toBe("Error");
-  expect(Error(undefined).toString()).toBe("Error");
-  expect(Error(null).toString()).toBe("Error: null");
-  expect(Error("test").toString()).toBe("Error: test");
-  expect(Error(42).toString()).toBe("Error: 42");
+    expect(Error().toString()).toBe("Error");
+    expect(Error(undefined).toString()).toBe("Error");
+    expect(Error(null).toString()).toBe("Error: null");
+    expect(Error("test").toString()).toBe("Error: test");
+    expect(Error(42).toString()).toBe("Error: 42");
 });

+ 43 - 41
Libraries/LibJS/Tests/builtins/Function/Function.js

@@ -1,49 +1,51 @@
 describe("correct behavior", () => {
-  test("constructor properties", () => {
-    expect(Function).toHaveLength(1);
-    expect(Function.name).toBe("Function");
-    expect(Function.prototype).toHaveLength(0);
-    expect(Function.prototype.name).toBe("");
-  });
+    test("constructor properties", () => {
+        expect(Function).toHaveLength(1);
+        expect(Function.name).toBe("Function");
+        expect(Function.prototype).toHaveLength(0);
+        expect(Function.prototype.name).toBe("");
+    });
 
-  test("typeof", () => {
-    expect(typeof Function()).toBe("function");
-    expect(typeof new Function()).toBe("function");
-  });
+    test("typeof", () => {
+        expect(typeof Function()).toBe("function");
+        expect(typeof new Function()).toBe("function");
+    });
 
-  test("basic functionality", () => {
-    expect(Function()()).toBeUndefined();
-    expect(new Function()()).toBeUndefined();
-    expect(Function("return 42")()).toBe(42);
-    expect(new Function("return 42")()).toBe(42);
-    expect(new Function("foo", "return foo")(42)).toBe(42);
-    expect(new Function("foo,bar", "return foo + bar")(1, 2)).toBe(3);
-    expect(new Function("foo", "bar", "return foo + bar")(1, 2)).toBe(3);
-    expect(new Function("foo", "bar,baz", "return foo + bar + baz")(1, 2, 3)).toBe(6);
-    expect(new Function("foo", "bar", "baz", "return foo + bar + baz")(1, 2, 3)).toBe(6);
-    expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(true)).toBe(42);
-    expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(false)).toBe(
-      "bar"
-    );
-    expect(new Function("return typeof Function()")()).toBe("function");
-    expect(new Function("x", "return function (y) { return x + y };")(1)(2)).toBe(3);
+    test("basic functionality", () => {
+        expect(Function()()).toBeUndefined();
+        expect(new Function()()).toBeUndefined();
+        expect(Function("return 42")()).toBe(42);
+        expect(new Function("return 42")()).toBe(42);
+        expect(new Function("foo", "return foo")(42)).toBe(42);
+        expect(new Function("foo,bar", "return foo + bar")(1, 2)).toBe(3);
+        expect(new Function("foo", "bar", "return foo + bar")(1, 2)).toBe(3);
+        expect(new Function("foo", "bar,baz", "return foo + bar + baz")(1, 2, 3)).toBe(6);
+        expect(new Function("foo", "bar", "baz", "return foo + bar + baz")(1, 2, 3)).toBe(6);
+        expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(true)).toBe(
+            42
+        );
+        expect(new Function("foo", "if (foo) { return 42; } else { return 'bar'; }")(false)).toBe(
+            "bar"
+        );
+        expect(new Function("return typeof Function()")()).toBe("function");
+        expect(new Function("x", "return function (y) { return x + y };")(1)(2)).toBe(3);
 
-    expect(new Function().name).toBe("anonymous");
-    expect(new Function().toString()).toBe("function anonymous() {\n  ???\n}");
-  });
+        expect(new Function().name).toBe("anonymous");
+        expect(new Function().toString()).toBe("function anonymous() {\n  ???\n}");
+    });
 });
 
 describe("errors", () => {
-  test("syntax error", () => {
-    expect(() => {
-      new Function("[");
-    })
-      // This might be confusing at first but keep in mind it's actually parsing
-      // function anonymous() { [ }
-      // This is in line with what other engines are reporting.
-      .toThrowWithMessage(
-        SyntaxError,
-        "Unexpected token CurlyClose. Expected BracketClose (line: 1, column: 26)"
-      );
-  });
+    test("syntax error", () => {
+        expect(() => {
+            new Function("[");
+        })
+            // This might be confusing at first but keep in mind it's actually parsing
+            // function anonymous() { [ }
+            // This is in line with what other engines are reporting.
+            .toThrowWithMessage(
+                SyntaxError,
+                "Unexpected token CurlyClose. Expected BracketClose (line: 1, column: 26)"
+            );
+    });
 });

+ 49 - 49
Libraries/LibJS/Tests/builtins/Function/Function.prototype.apply.js

@@ -1,51 +1,51 @@
 test("basic functionality", () => {
-  function Foo(arg) {
-    this.foo = arg;
-  }
-  function Bar(arg) {
-    this.bar = arg;
-  }
-  function FooBar(arg) {
-    Foo.apply(this, [arg]);
-    Bar.apply(this, [arg]);
-  }
-  function FooBarBaz(arg) {
-    Foo.apply(this, [arg]);
-    Bar.apply(this, [arg]);
-    this.baz = arg;
-  }
-
-  expect(Function.prototype.apply).toHaveLength(2);
-
-  var foo = new Foo("test");
-  expect(foo.foo).toBe("test");
-  expect(foo.bar).toBeUndefined();
-  expect(foo.baz).toBeUndefined();
-
-  var bar = new Bar("test");
-  expect(bar.foo).toBeUndefined();
-  expect(bar.bar).toBe("test");
-  expect(bar.baz).toBeUndefined();
-
-  var foobar = new FooBar("test");
-  expect(foobar.foo).toBe("test");
-  expect(foobar.bar).toBe("test");
-  expect(foobar.baz).toBeUndefined();
-
-  var foobarbaz = new FooBarBaz("test");
-  expect(foobarbaz.foo).toBe("test");
-  expect(foobarbaz.bar).toBe("test");
-  expect(foobarbaz.baz).toBe("test");
-
-  expect(Math.abs.apply(null, [-1])).toBe(1);
-
-  var add = (x, y) => x + y;
-  expect(add.apply(null, [1, 2])).toBe(3);
-
-  var multiply = function (x, y) {
-    return x * y;
-  };
-  expect(multiply.apply(null, [3, 4])).toBe(12);
-
-  expect((() => this).apply("foo")).toBe(globalThis);
+    function Foo(arg) {
+        this.foo = arg;
+    }
+    function Bar(arg) {
+        this.bar = arg;
+    }
+    function FooBar(arg) {
+        Foo.apply(this, [arg]);
+        Bar.apply(this, [arg]);
+    }
+    function FooBarBaz(arg) {
+        Foo.apply(this, [arg]);
+        Bar.apply(this, [arg]);
+        this.baz = arg;
+    }
+
+    expect(Function.prototype.apply).toHaveLength(2);
+
+    var foo = new Foo("test");
+    expect(foo.foo).toBe("test");
+    expect(foo.bar).toBeUndefined();
+    expect(foo.baz).toBeUndefined();
+
+    var bar = new Bar("test");
+    expect(bar.foo).toBeUndefined();
+    expect(bar.bar).toBe("test");
+    expect(bar.baz).toBeUndefined();
+
+    var foobar = new FooBar("test");
+    expect(foobar.foo).toBe("test");
+    expect(foobar.bar).toBe("test");
+    expect(foobar.baz).toBeUndefined();
+
+    var foobarbaz = new FooBarBaz("test");
+    expect(foobarbaz.foo).toBe("test");
+    expect(foobarbaz.bar).toBe("test");
+    expect(foobarbaz.baz).toBe("test");
+
+    expect(Math.abs.apply(null, [-1])).toBe(1);
+
+    var add = (x, y) => x + y;
+    expect(add.apply(null, [1, 2])).toBe(3);
+
+    var multiply = function (x, y) {
+        return x * y;
+    };
+    expect(multiply.apply(null, [3, 4])).toBe(12);
+
+    expect((() => this).apply("foo")).toBe(globalThis);
 });

+ 132 - 132
Libraries/LibJS/Tests/builtins/Function/Function.prototype.bind.js

@@ -1,149 +1,149 @@
 describe("basic behavior", () => {
-  test("basic binding", () => {
-    expect(Function.prototype.bind).toHaveLength(1);
-
-    var charAt = String.prototype.charAt.bind("bar");
-    expect(charAt(0) + charAt(1) + charAt(2)).toBe("bar");
-
-    function getB() {
-      return this.toUpperCase().charAt(0);
-    }
-    expect(getB.bind("bar")()).toBe("B");
-  });
-
-  test("bound functions work with array functions", () => {
-    var Make3 = Number.bind(null, 3);
-    expect([55].map(Make3)[0]).toBe(3);
-
-    var MakeTrue = Boolean.bind(null, true);
-
-    expect([1, 2, 3].filter(MakeTrue)).toHaveLength(3);
-    expect(
-      [1, 2, 3].reduce(
-        function (acc, x) {
-          return acc + x;
-        }.bind(null, 4, 5)
-      )
-    ).toBe(9);
-    expect(
-      [1, 2, 3].reduce(
-        function (acc, x) {
-          return acc + x + this;
-        }.bind(3)
-      )
-    ).toBe(12);
-  });
+    test("basic binding", () => {
+        expect(Function.prototype.bind).toHaveLength(1);
+
+        var charAt = String.prototype.charAt.bind("bar");
+        expect(charAt(0) + charAt(1) + charAt(2)).toBe("bar");
+
+        function getB() {
+            return this.toUpperCase().charAt(0);
+        }
+        expect(getB.bind("bar")()).toBe("B");
+    });
+
+    test("bound functions work with array functions", () => {
+        var Make3 = Number.bind(null, 3);
+        expect([55].map(Make3)[0]).toBe(3);
+
+        var MakeTrue = Boolean.bind(null, true);
+
+        expect([1, 2, 3].filter(MakeTrue)).toHaveLength(3);
+        expect(
+            [1, 2, 3].reduce(
+                function (acc, x) {
+                    return acc + x;
+                }.bind(null, 4, 5)
+            )
+        ).toBe(9);
+        expect(
+            [1, 2, 3].reduce(
+                function (acc, x) {
+                    return acc + x + this;
+                }.bind(3)
+            )
+        ).toBe(12);
+    });
 });
 
 describe("bound function arguments", () => {
-  function sum(a, b, c) {
-    return a + b + c;
-  }
-  var boundSum = sum.bind(null, 10, 5);
-
-  test("arguments are bound to the function", () => {
-    expect(boundSum()).toBeNaN();
-    expect(boundSum(5)).toBe(20);
-    expect(boundSum(5, 6, 7)).toBe(20);
-  });
-
-  test("arguments are appended to a BoundFunction's bound arguments", () => {
-    expect(boundSum.bind(null, 5)()).toBe(20);
-  });
-
-  test("binding a constructor's arguments", () => {
-    var Make5 = Number.bind(null, 5);
-    expect(Make5()).toBe(5);
-    expect(new Make5().valueOf()).toBe(5);
-  });
-
-  test("length property", () => {
-    expect(sum).toHaveLength(3);
-    expect(boundSum).toHaveLength(1);
-    expect(boundSum.bind(null, 5)).toHaveLength(0);
-    expect(boundSum.bind(null, 5, 6, 7, 8)).toHaveLength(0);
-  });
+    function sum(a, b, c) {
+        return a + b + c;
+    }
+    var boundSum = sum.bind(null, 10, 5);
+
+    test("arguments are bound to the function", () => {
+        expect(boundSum()).toBeNaN();
+        expect(boundSum(5)).toBe(20);
+        expect(boundSum(5, 6, 7)).toBe(20);
+    });
+
+    test("arguments are appended to a BoundFunction's bound arguments", () => {
+        expect(boundSum.bind(null, 5)()).toBe(20);
+    });
+
+    test("binding a constructor's arguments", () => {
+        var Make5 = Number.bind(null, 5);
+        expect(Make5()).toBe(5);
+        expect(new Make5().valueOf()).toBe(5);
+    });
+
+    test("length property", () => {
+        expect(sum).toHaveLength(3);
+        expect(boundSum).toHaveLength(1);
+        expect(boundSum.bind(null, 5)).toHaveLength(0);
+        expect(boundSum.bind(null, 5, 6, 7, 8)).toHaveLength(0);
+    });
 });
 
 describe("bound function |this|", () => {
-  function identity() {
-    return this;
-  }
-
-  test("captures global object as |this| if |this| is null or undefined", () => {
-    expect(identity.bind()()).toBe(globalThis);
-    expect(identity.bind(null)()).toBe(globalThis);
-    expect(identity.bind(undefined)()).toBe(globalThis);
-
-    function Foo() {
-      expect(identity.bind()()).toBe(globalThis);
-      expect(identity.bind(this)()).toBe(this);
+    function identity() {
+        return this;
     }
-    new Foo();
-  });
 
-  test("does not capture global object as |this| if |this| is null or undefined in strict mode", () => {
-    "use strict";
+    test("captures global object as |this| if |this| is null or undefined", () => {
+        expect(identity.bind()()).toBe(globalThis);
+        expect(identity.bind(null)()).toBe(globalThis);
+        expect(identity.bind(undefined)()).toBe(globalThis);
+
+        function Foo() {
+            expect(identity.bind()()).toBe(globalThis);
+            expect(identity.bind(this)()).toBe(this);
+        }
+        new Foo();
+    });
+
+    test("does not capture global object as |this| if |this| is null or undefined in strict mode", () => {
+        "use strict";
+
+        function strictIdentity() {
+            return this;
+        }
+
+        expect(strictIdentity.bind()()).toBeUndefined();
+        expect(strictIdentity.bind(null)()).toBeNull();
+        expect(strictIdentity.bind(undefined)()).toBeUndefined();
+    });
+
+    test("primitive |this| values are converted to objects", () => {
+        expect(identity.bind("foo")()).toBeInstanceOf(String);
+        expect(identity.bind(123)()).toBeInstanceOf(Number);
+        expect(identity.bind(true)()).toBeInstanceOf(Boolean);
+    });
+
+    test("bound functions retain |this| values passed to them", () => {
+        var obj = { foo: "bar" };
+        expect(identity.bind(obj)()).toBe(obj);
+    });
+
+    test("bound |this| cannot be changed after being set", () => {
+        expect(identity.bind("foo").bind(123)()).toBeInstanceOf(String);
+    });
+
+    test("arrow functions cannot be bound", () => {
+        expect((() => this).bind("foo")()).toBe(globalThis);
+    });
+});
 
-    function strictIdentity() {
-      return this;
+describe("bound function constructors", () => {
+    function Bar() {
+        this.x = 3;
+        this.y = 4;
     }
 
-    expect(strictIdentity.bind()()).toBeUndefined();
-    expect(strictIdentity.bind(null)()).toBeNull();
-    expect(strictIdentity.bind(undefined)()).toBeUndefined();
-  });
-
-  test("primitive |this| values are converted to objects", () => {
-    expect(identity.bind("foo")()).toBeInstanceOf(String);
-    expect(identity.bind(123)()).toBeInstanceOf(Number);
-    expect(identity.bind(true)()).toBeInstanceOf(Boolean);
-  });
-
-  test("bound functions retain |this| values passed to them", () => {
-    var obj = { foo: "bar" };
-    expect(identity.bind(obj)()).toBe(obj);
-  });
-
-  test("bound |this| cannot be changed after being set", () => {
-    expect(identity.bind("foo").bind(123)()).toBeInstanceOf(String);
-  });
-
-  test("arrow functions cannot be bound", () => {
-    expect((() => this).bind("foo")()).toBe(globalThis);
-  });
-});
+    Bar.prototype.baz = "baz";
+    var BoundBar = Bar.bind({ u: 5, v: 6 });
+    var bar = new BoundBar();
 
-describe("bound function constructors", () => {
-  function Bar() {
-    this.x = 3;
-    this.y = 4;
-  }
-
-  Bar.prototype.baz = "baz";
-  var BoundBar = Bar.bind({ u: 5, v: 6 });
-  var bar = new BoundBar();
-
-  test("bound |this| value does not affect constructor", () => {
-    expect(bar.x).toBe(3);
-    expect(bar.y).toBe(4);
-    expect(typeof bar.u).toBe("undefined");
-    expect(typeof bar.v).toBe("undefined");
-  });
-
-  test("bound functions retain original prototype", () => {
-    expect(bar.baz).toBe("baz");
-  });
-
-  test("bound functions do not have a prototype property", () => {
-    expect(BoundBar).not.toHaveProperty("prototype");
-  });
+    test("bound |this| value does not affect constructor", () => {
+        expect(bar.x).toBe(3);
+        expect(bar.y).toBe(4);
+        expect(typeof bar.u).toBe("undefined");
+        expect(typeof bar.v).toBe("undefined");
+    });
+
+    test("bound functions retain original prototype", () => {
+        expect(bar.baz).toBe("baz");
+    });
+
+    test("bound functions do not have a prototype property", () => {
+        expect(BoundBar).not.toHaveProperty("prototype");
+    });
 });
 
 describe("errors", () => {
-  test("does not accept non-function values", () => {
-    expect(() => {
-      Function.prototype.bind.call("foo");
-    }).toThrowWithMessage(TypeError, "Not a Function object");
-  });
+    test("does not accept non-function values", () => {
+        expect(() => {
+            Function.prototype.bind.call("foo");
+        }).toThrowWithMessage(TypeError, "Not a Function object");
+    });
 });

+ 48 - 48
Libraries/LibJS/Tests/builtins/Function/Function.prototype.call.js

@@ -1,53 +1,53 @@
 test("length", () => {
-  expect(Function.prototype.call).toHaveLength(1);
+    expect(Function.prototype.call).toHaveLength(1);
 });
 
 test("basic functionality", () => {
-  function Foo(arg) {
-    this.foo = arg;
-  }
-  function Bar(arg) {
-    this.bar = arg;
-  }
-  function FooBar(arg) {
-    Foo.call(this, arg);
-    Bar.call(this, arg);
-  }
-  function FooBarBaz(arg) {
-    Foo.call(this, arg);
-    Bar.call(this, arg);
-    this.baz = arg;
-  }
-
-  var foo = new Foo("test");
-  expect(foo.foo).toBe("test");
-  expect(foo.bar).toBeUndefined();
-  expect(foo.baz).toBeUndefined();
-
-  var bar = new Bar("test");
-  expect(bar.foo).toBeUndefined();
-  expect(bar.bar).toBe("test");
-  expect(bar.baz).toBeUndefined();
-
-  var foobar = new FooBar("test");
-  expect(foobar.foo).toBe("test");
-  expect(foobar.bar).toBe("test");
-  expect(foobar.baz).toBeUndefined();
-
-  var foobarbaz = new FooBarBaz("test");
-  expect(foobarbaz.foo).toBe("test");
-  expect(foobarbaz.bar).toBe("test");
-  expect(foobarbaz.baz).toBe("test");
-
-  expect(Math.abs.call(null, -1)).toBe(1);
-
-  var add = (x, y) => x + y;
-  expect(add.call(null, 1, 2)).toBe(3);
-
-  var multiply = function (x, y) {
-    return x * y;
-  };
-  expect(multiply.call(null, 3, 4)).toBe(12);
-
-  expect((() => this).call("foo")).toBe(globalThis);
+    function Foo(arg) {
+        this.foo = arg;
+    }
+    function Bar(arg) {
+        this.bar = arg;
+    }
+    function FooBar(arg) {
+        Foo.call(this, arg);
+        Bar.call(this, arg);
+    }
+    function FooBarBaz(arg) {
+        Foo.call(this, arg);
+        Bar.call(this, arg);
+        this.baz = arg;
+    }
+
+    var foo = new Foo("test");
+    expect(foo.foo).toBe("test");
+    expect(foo.bar).toBeUndefined();
+    expect(foo.baz).toBeUndefined();
+
+    var bar = new Bar("test");
+    expect(bar.foo).toBeUndefined();
+    expect(bar.bar).toBe("test");
+    expect(bar.baz).toBeUndefined();
+
+    var foobar = new FooBar("test");
+    expect(foobar.foo).toBe("test");
+    expect(foobar.bar).toBe("test");
+    expect(foobar.baz).toBeUndefined();
+
+    var foobarbaz = new FooBarBaz("test");
+    expect(foobarbaz.foo).toBe("test");
+    expect(foobarbaz.bar).toBe("test");
+    expect(foobarbaz.baz).toBe("test");
+
+    expect(Math.abs.call(null, -1)).toBe(1);
+
+    var add = (x, y) => x + y;
+    expect(add.call(null, 1, 2)).toBe(3);
+
+    var multiply = function (x, y) {
+        return x * y;
+    };
+    expect(multiply.call(null, 3, 4)).toBe(12);
+
+    expect((() => this).call("foo")).toBe(globalThis);
 });

+ 15 - 15
Libraries/LibJS/Tests/builtins/Function/Function.prototype.toString.js

@@ -1,17 +1,17 @@
 test("basic functionality", () => {
-  expect(function () {}.toString()).toBe("function () {\n  ???\n}");
-  expect(function (foo) {}.toString()).toBe("function (foo) {\n  ???\n}");
-  expect(function (foo, bar, baz) {}.toString()).toBe("function (foo, bar, baz) {\n  ???\n}");
-  expect(
-    function (foo, bar, baz) {
-      if (foo) {
-        return baz;
-      } else if (bar) {
-        return foo;
-      }
-      return bar + 42;
-    }.toString()
-  ).toBe("function (foo, bar, baz) {\n  ???\n}");
-  expect(console.debug.toString()).toBe("function debug() {\n  [NativeFunction]\n}");
-  expect(Function.toString()).toBe("function Function() {\n  [FunctionConstructor]\n}");
+    expect(function () {}.toString()).toBe("function () {\n  ???\n}");
+    expect(function (foo) {}.toString()).toBe("function (foo) {\n  ???\n}");
+    expect(function (foo, bar, baz) {}.toString()).toBe("function (foo, bar, baz) {\n  ???\n}");
+    expect(
+        function (foo, bar, baz) {
+            if (foo) {
+                return baz;
+            } else if (bar) {
+                return foo;
+            }
+            return bar + 42;
+        }.toString()
+    ).toBe("function (foo, bar, baz) {\n  ???\n}");
+    expect(console.debug.toString()).toBe("function debug() {\n  [NativeFunction]\n}");
+    expect(Function.toString()).toBe("function Function() {\n  [FunctionConstructor]\n}");
 });

+ 20 - 20
Libraries/LibJS/Tests/builtins/Infinity/Infinity.js

@@ -1,22 +1,22 @@
 test("basic functionality", () => {
-  expect(Infinity + "").toBe("Infinity");
-  expect(-Infinity + "").toBe("-Infinity");
-  expect(Infinity).toBe(Infinity);
-  expect(Infinity - 1).toBe(Infinity);
-  expect(Infinity + 1).toBe(Infinity);
-  expect(-Infinity).toBe(-Infinity);
-  expect(-Infinity - 1).toBe(-Infinity);
-  expect(-Infinity + 1).toBe(-Infinity);
-  expect(1 / Infinity).toBe(0);
-  expect(1 / -Infinity).toBe(-0);
-  expect(1 / 0).toBe(Infinity);
-  expect(-1 / 0).toBe(-Infinity);
-  expect(-100).toBeLessThan(Infinity);
-  expect(0).toBeLessThan(Infinity);
-  expect(100).toBeLessThan(Infinity);
-  expect(-Infinity).toBeLessThan(Infinity);
-  expect(-100).toBeGreaterThan(-Infinity);
-  expect(0).toBeGreaterThan(-Infinity);
-  expect(100).toBeGreaterThan(-Infinity);
-  expect(Infinity).toBeGreaterThan(-Infinity);
+    expect(Infinity + "").toBe("Infinity");
+    expect(-Infinity + "").toBe("-Infinity");
+    expect(Infinity).toBe(Infinity);
+    expect(Infinity - 1).toBe(Infinity);
+    expect(Infinity + 1).toBe(Infinity);
+    expect(-Infinity).toBe(-Infinity);
+    expect(-Infinity - 1).toBe(-Infinity);
+    expect(-Infinity + 1).toBe(-Infinity);
+    expect(1 / Infinity).toBe(0);
+    expect(1 / -Infinity).toBe(-0);
+    expect(1 / 0).toBe(Infinity);
+    expect(-1 / 0).toBe(-Infinity);
+    expect(-100).toBeLessThan(Infinity);
+    expect(0).toBeLessThan(Infinity);
+    expect(100).toBeLessThan(Infinity);
+    expect(-Infinity).toBeLessThan(Infinity);
+    expect(-100).toBeGreaterThan(-Infinity);
+    expect(0).toBeGreaterThan(-Infinity);
+    expect(100).toBeGreaterThan(-Infinity);
+    expect(Infinity).toBeGreaterThan(-Infinity);
 });

+ 7 - 5
Libraries/LibJS/Tests/builtins/JSON/JSON.parse-reviver.js

@@ -1,9 +1,11 @@
 test("basic functionality", () => {
-  let string = `{"var1":10,"var2":"hello","var3":{"nested":5}}`;
+    let string = `{"var1":10,"var2":"hello","var3":{"nested":5}}`;
 
-  let object = JSON.parse(string, (key, value) => (typeof value === "number" ? value * 2 : value));
-  expect(object).toEqual({ var1: 20, var2: "hello", var3: { nested: 10 } });
+    let object = JSON.parse(string, (key, value) =>
+        typeof value === "number" ? value * 2 : value
+    );
+    expect(object).toEqual({ var1: 20, var2: "hello", var3: { nested: 10 } });
 
-  object = JSON.parse(string, (key, value) => (typeof value === "number" ? undefined : value));
-  expect(object).toEqual({ var2: "hello", var3: {} });
+    object = JSON.parse(string, (key, value) => (typeof value === "number" ? undefined : value));
+    expect(object).toEqual({ var2: "hello", var3: {} });
 });

+ 30 - 30
Libraries/LibJS/Tests/builtins/JSON/JSON.parse.js

@@ -1,37 +1,37 @@
 test("basic functionality", () => {
-  expect(JSON.parse).toHaveLength(2);
+    expect(JSON.parse).toHaveLength(2);
 
-  const properties = [
-    ["5", 5],
-    ["null", null],
-    ["true", true],
-    ["false", false],
-    ['"test"', "test"],
-    ['[1,2,"foo"]', [1, 2, "foo"]],
-    ['{"foo":1,"bar":"baz"}', { foo: 1, bar: "baz" }],
-  ];
+    const properties = [
+        ["5", 5],
+        ["null", null],
+        ["true", true],
+        ["false", false],
+        ['"test"', "test"],
+        ['[1,2,"foo"]', [1, 2, "foo"]],
+        ['{"foo":1,"bar":"baz"}', { foo: 1, bar: "baz" }],
+    ];
 
-  properties.forEach(testCase => {
-    expect(JSON.parse(testCase[0])).toEqual(testCase[1]);
-  });
+    properties.forEach(testCase => {
+        expect(JSON.parse(testCase[0])).toEqual(testCase[1]);
+    });
 });
 
 test("syntax errors", () => {
-  [
-    undefined,
-    NaN,
-    -NaN,
-    Infinity,
-    -Infinity,
-    '{ "foo" }',
-    '{ foo: "bar" }',
-    "[1,2,3,]",
-    "[1,2,3, ]",
-    '{ "foo": "bar",}',
-    '{ "foo": "bar", }',
-  ].forEach(test => {
-    expect(() => {
-      JSON.parse(test);
-    }).toThrow(SyntaxError);
-  });
+    [
+        undefined,
+        NaN,
+        -NaN,
+        Infinity,
+        -Infinity,
+        '{ "foo" }',
+        '{ foo: "bar" }',
+        "[1,2,3,]",
+        "[1,2,3, ]",
+        '{ "foo": "bar",}',
+        '{ "foo": "bar", }',
+    ].forEach(test => {
+        expect(() => {
+            JSON.parse(test);
+        }).toThrow(SyntaxError);
+    });
 });

+ 22 - 22
Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-order.js

@@ -1,30 +1,30 @@
 test("basic functionality", () => {
-  let o = {
-    key1: "key1",
-    key2: "key2",
-    key3: "key3",
-  };
+    let o = {
+        key1: "key1",
+        key2: "key2",
+        key3: "key3",
+    };
 
-  Object.defineProperty(o, "defined", {
-    enumerable: true,
-    get() {
-      o.prop = "prop";
-      return "defined";
-    },
-  });
+    Object.defineProperty(o, "defined", {
+        enumerable: true,
+        get() {
+            o.prop = "prop";
+            return "defined";
+        },
+    });
 
-  o.key4 = "key4";
+    o.key4 = "key4";
 
-  o[2] = 2;
-  o[0] = 0;
-  o[1] = 1;
+    o[2] = 2;
+    o[0] = 0;
+    o[1] = 1;
 
-  delete o.key1;
-  delete o.key3;
+    delete o.key1;
+    delete o.key3;
 
-  o.key1 = "key1";
+    o.key1 = "key1";
 
-  expect(JSON.stringify(o)).toBe(
-    '{"0":0,"1":1,"2":2,"key2":"key2","defined":"defined","key4":"key4","key1":"key1"}'
-  );
+    expect(JSON.stringify(o)).toBe(
+        '{"0":0,"1":1,"2":2,"key2":"key2","defined":"defined","key4":"key4","key1":"key1"}'
+    );
 });

+ 8 - 8
Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-proxy.js

@@ -1,11 +1,11 @@
 test("basic functionality", () => {
-  let p = new Proxy([], {
-    get(_, key) {
-      if (key === "length") return 3;
-      return Number(key);
-    },
-  });
+    let p = new Proxy([], {
+        get(_, key) {
+            if (key === "length") return 3;
+            return Number(key);
+        },
+    });
 
-  expect(JSON.stringify(p)).toBe("[0,1,2]");
-  expect(JSON.stringify([[new Proxy(p, {})]])).toBe("[[[0,1,2]]]");
+    expect(JSON.stringify(p)).toBe("[0,1,2]");
+    expect(JSON.stringify([[new Proxy(p, {})]])).toBe("[[[0,1,2]]]");
 });

+ 31 - 31
Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-replacer.js

@@ -1,38 +1,38 @@
 test("basic functionality", () => {
-  let o = {
-    var1: "foo",
-    var2: 42,
-    arr: [
-      1,
-      2,
-      {
-        nested: {
-          hello: "world",
+    let o = {
+        var1: "foo",
+        var2: 42,
+        arr: [
+            1,
+            2,
+            {
+                nested: {
+                    hello: "world",
+                },
+                get x() {
+                    return 10;
+                },
+            },
+        ],
+        obj: {
+            subarr: [3],
         },
-        get x() {
-          return 10;
-        },
-      },
-    ],
-    obj: {
-      subarr: [3],
-    },
-  };
+    };
 
-  let string = JSON.stringify(o, (key, value) => {
-    if (key === "hello") return undefined;
-    if (value === 10) return 20;
-    if (key === "subarr") return [3, 4, 5];
-    return value;
-  });
+    let string = JSON.stringify(o, (key, value) => {
+        if (key === "hello") return undefined;
+        if (value === 10) return 20;
+        if (key === "subarr") return [3, 4, 5];
+        return value;
+    });
 
-  expect(string).toBe(
-    '{"var1":"foo","var2":42,"arr":[1,2,{"nested":{},"x":20}],"obj":{"subarr":[3,4,5]}}'
-  );
+    expect(string).toBe(
+        '{"var1":"foo","var2":42,"arr":[1,2,{"nested":{},"x":20}],"obj":{"subarr":[3,4,5]}}'
+    );
 
-  string = JSON.stringify(o, ["var1", "var1", "var2", "obj"]);
-  expect(string).toBe('{"var1":"foo","var2":42,"obj":{}}');
+    string = JSON.stringify(o, ["var1", "var1", "var2", "obj"]);
+    expect(string).toBe('{"var1":"foo","var2":42,"obj":{}}');
 
-  string = JSON.stringify(o, ["var1", "var1", "var2", "obj", "subarr"]);
-  expect(string).toBe('{"var1":"foo","var2":42,"obj":{"subarr":[3]}}');
+    string = JSON.stringify(o, ["var1", "var1", "var2", "obj", "subarr"]);
+    expect(string).toBe('{"var1":"foo","var2":42,"obj":{"subarr":[3]}}');
 });

+ 19 - 19
Libraries/LibJS/Tests/builtins/JSON/JSON.stringify-space.js

@@ -1,20 +1,20 @@
 test("basic functionality", () => {
-  let o = {
-    foo: 1,
-    bar: "baz",
-    qux: {
-      get x() {
-        return 10;
-      },
-      y() {
-        return 20;
-      },
-      arr: [1, 2, 3],
-    },
-  };
+    let o = {
+        foo: 1,
+        bar: "baz",
+        qux: {
+            get x() {
+                return 10;
+            },
+            y() {
+                return 20;
+            },
+            arr: [1, 2, 3],
+        },
+    };
 
-  let string = JSON.stringify(o, null, 4);
-  let expected = `{
+    let string = JSON.stringify(o, null, 4);
+    let expected = `{
     "foo": 1,
     "bar": "baz",
     "qux": {
@@ -27,10 +27,10 @@ test("basic functionality", () => {
     }
 }`;
 
-  expect(string).toBe(expected);
+    expect(string).toBe(expected);
 
-  string = JSON.stringify(o, null, "abcd");
-  expected = `{
+    string = JSON.stringify(o, null, "abcd");
+    expected = `{
 abcd"foo": 1,
 abcd"bar": "baz",
 abcd"qux": {
@@ -43,5 +43,5 @@ abcdabcd]
 abcd}
 }`;
 
-  expect(string).toBe(expected);
+    expect(string).toBe(expected);
 });

+ 59 - 59
Libraries/LibJS/Tests/builtins/JSON/JSON.stringify.js

@@ -1,71 +1,71 @@
 describe("correct behavior", () => {
-  test("length", () => {
-    expect(JSON.stringify).toHaveLength(3);
-  });
+    test("length", () => {
+        expect(JSON.stringify).toHaveLength(3);
+    });
 
-  test("basic functionality", () => {
-    [
-      [5, "5"],
-      [undefined, undefined],
-      [null, "null"],
-      [NaN, "null"],
-      [-NaN, "null"],
-      [Infinity, "null"],
-      [-Infinity, "null"],
-      [true, "true"],
-      [false, "false"],
-      ["test", '"test"'],
-      [new Number(5), "5"],
-      [new Boolean(false), "false"],
-      [new String("test"), '"test"'],
-      [() => {}, undefined],
-      [[1, 2, "foo"], '[1,2,"foo"]'],
-      [{ foo: 1, bar: "baz", qux() {} }, '{"foo":1,"bar":"baz"}'],
-      [
-        {
-          var1: 1,
-          var2: 2,
-          toJSON(key) {
-            let o = this;
-            o.var2 = 10;
-            return o;
-          },
-        },
-        '{"var1":1,"var2":10}',
-      ],
-    ].forEach(testCase => {
-      expect(JSON.stringify(testCase[0])).toEqual(testCase[1]);
+    test("basic functionality", () => {
+        [
+            [5, "5"],
+            [undefined, undefined],
+            [null, "null"],
+            [NaN, "null"],
+            [-NaN, "null"],
+            [Infinity, "null"],
+            [-Infinity, "null"],
+            [true, "true"],
+            [false, "false"],
+            ["test", '"test"'],
+            [new Number(5), "5"],
+            [new Boolean(false), "false"],
+            [new String("test"), '"test"'],
+            [() => {}, undefined],
+            [[1, 2, "foo"], '[1,2,"foo"]'],
+            [{ foo: 1, bar: "baz", qux() {} }, '{"foo":1,"bar":"baz"}'],
+            [
+                {
+                    var1: 1,
+                    var2: 2,
+                    toJSON(key) {
+                        let o = this;
+                        o.var2 = 10;
+                        return o;
+                    },
+                },
+                '{"var1":1,"var2":10}',
+            ],
+        ].forEach(testCase => {
+            expect(JSON.stringify(testCase[0])).toEqual(testCase[1]);
+        });
     });
-  });
 
-  test("ignores non-enumerable properties", () => {
-    let o = { foo: "bar" };
-    Object.defineProperty(o, "baz", { value: "qux", enumerable: false });
-    expect(JSON.stringify(o)).toBe('{"foo":"bar"}');
-  });
+    test("ignores non-enumerable properties", () => {
+        let o = { foo: "bar" };
+        Object.defineProperty(o, "baz", { value: "qux", enumerable: false });
+        expect(JSON.stringify(o)).toBe('{"foo":"bar"}');
+    });
 });
 
 describe("errors", () => {
-  test("cannot serialize BigInt", () => {
-    expect(() => {
-      JSON.stringify(5n);
-    }).toThrow(TypeError, "Cannot serialize BigInt value to JSON");
-  });
+    test("cannot serialize BigInt", () => {
+        expect(() => {
+            JSON.stringify(5n);
+        }).toThrow(TypeError, "Cannot serialize BigInt value to JSON");
+    });
 
-  test("cannot serialize circular structures", () => {
-    let bad1 = {};
-    bad1.foo = bad1;
-    let bad2 = [];
-    bad2[5] = [[[bad2]]];
+    test("cannot serialize circular structures", () => {
+        let bad1 = {};
+        bad1.foo = bad1;
+        let bad2 = [];
+        bad2[5] = [[[bad2]]];
 
-    let bad3a = { foo: "bar" };
-    let bad3b = [1, 2, bad3a];
-    bad3a.bad = bad3b;
+        let bad3a = { foo: "bar" };
+        let bad3b = [1, 2, bad3a];
+        bad3a.bad = bad3b;
 
-    [bad1, bad2, bad3a].forEach(bad => {
-      expect(() => {
-        JSON.stringify(bad);
-      }).toThrow(TypeError, "Cannot stringify circular object");
+        [bad1, bad2, bad3a].forEach(bad => {
+            expect(() => {
+                JSON.stringify(bad);
+            }).toThrow(TypeError, "Cannot stringify circular object");
+        });
     });
-  });
 });

+ 8 - 8
Libraries/LibJS/Tests/builtins/Math/Math-constants.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  expect(Math.E).toBeCloseTo(2.718281);
-  expect(Math.LN2).toBeCloseTo(0.693147);
-  expect(Math.LN10).toBeCloseTo(2.302585);
-  expect(Math.LOG2E).toBeCloseTo(1.442695);
-  expect(Math.LOG10E).toBeCloseTo(0.434294);
-  expect(Math.PI).toBeCloseTo(3.1415926);
-  expect(Math.SQRT1_2).toBeCloseTo(0.707106);
-  expect(Math.SQRT2).toBeCloseTo(1.414213);
+    expect(Math.E).toBeCloseTo(2.718281);
+    expect(Math.LN2).toBeCloseTo(0.693147);
+    expect(Math.LN10).toBeCloseTo(2.302585);
+    expect(Math.LOG2E).toBeCloseTo(1.442695);
+    expect(Math.LOG10E).toBeCloseTo(0.434294);
+    expect(Math.PI).toBeCloseTo(3.1415926);
+    expect(Math.SQRT1_2).toBeCloseTo(0.707106);
+    expect(Math.SQRT2).toBeCloseTo(1.414213);
 });

+ 11 - 11
Libraries/LibJS/Tests/builtins/Math/Math.abs.js

@@ -1,14 +1,14 @@
 test("basic functionality", () => {
-  expect(Math.abs).toHaveLength(1);
+    expect(Math.abs).toHaveLength(1);
 
-  expect(Math.abs("-1")).toBe(1);
-  expect(Math.abs(-2)).toBe(2);
-  expect(Math.abs(null)).toBe(0);
-  expect(Math.abs("")).toBe(0);
-  expect(Math.abs([])).toBe(0);
-  expect(Math.abs([2])).toBe(2);
-  expect(Math.abs([1, 2])).toBeNaN();
-  expect(Math.abs({})).toBeNaN();
-  expect(Math.abs("string")).toBeNaN();
-  expect(Math.abs()).toBeNaN();
+    expect(Math.abs("-1")).toBe(1);
+    expect(Math.abs(-2)).toBe(2);
+    expect(Math.abs(null)).toBe(0);
+    expect(Math.abs("")).toBe(0);
+    expect(Math.abs([])).toBe(0);
+    expect(Math.abs([2])).toBe(2);
+    expect(Math.abs([1, 2])).toBeNaN();
+    expect(Math.abs({})).toBeNaN();
+    expect(Math.abs("string")).toBeNaN();
+    expect(Math.abs()).toBeNaN();
 });

+ 6 - 6
Libraries/LibJS/Tests/builtins/Math/Math.acosh.js

@@ -1,9 +1,9 @@
 test("basic functionality", () => {
-  expect(Math.acosh).toHaveLength(1);
+    expect(Math.acosh).toHaveLength(1);
 
-  expect(Math.acosh(-1)).toBeNaN();
-  expect(Math.acosh(0)).toBeNaN();
-  expect(Math.acosh(0.5)).toBeNaN();
-  expect(Math.acosh(1)).toBeCloseTo(0);
-  // FIXME: expect(Math.acosh(2)).toBeCloseTo(1.316957);
+    expect(Math.acosh(-1)).toBeNaN();
+    expect(Math.acosh(0)).toBeNaN();
+    expect(Math.acosh(0.5)).toBeNaN();
+    expect(Math.acosh(1)).toBeCloseTo(0);
+    // FIXME: expect(Math.acosh(2)).toBeCloseTo(1.316957);
 });

+ 3 - 3
Libraries/LibJS/Tests/builtins/Math/Math.asinh.js

@@ -1,6 +1,6 @@
 test("basic functionality", () => {
-  expect(Math.asinh).toHaveLength(1);
+    expect(Math.asinh).toHaveLength(1);
 
-  expect(Math.asinh(0)).toBeCloseTo(0);
-  // FIXME: expect(Math.asinh(1)).toBeCloseTo(0.881373);
+    expect(Math.asinh(0)).toBeCloseTo(0);
+    // FIXME: expect(Math.asinh(1)).toBeCloseTo(0.881373);
 });

+ 7 - 7
Libraries/LibJS/Tests/builtins/Math/Math.atanh.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  expect(Math.atanh).toHaveLength(1);
+    expect(Math.atanh).toHaveLength(1);
 
-  expect(Math.atanh(-2)).toBeNaN();
-  expect(Math.atanh(2)).toBeNaN();
-  expect(Math.atanh(-1)).toBe(-Infinity);
-  // FIXME: expect(Math.atanh(0)).toBe(0);
-  expect(Math.atanh(0.5)).toBeCloseTo(0.549306);
-  // FIXME: expect(Math.atanh(1)).toBe(Infinity);
+    expect(Math.atanh(-2)).toBeNaN();
+    expect(Math.atanh(2)).toBeNaN();
+    expect(Math.atanh(-1)).toBe(-Infinity);
+    // FIXME: expect(Math.atanh(0)).toBe(0);
+    expect(Math.atanh(0.5)).toBeCloseTo(0.549306);
+    // FIXME: expect(Math.atanh(1)).toBe(Infinity);
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Math/Math.cbrt.js

@@ -1,12 +1,12 @@
 test("basic functionality", () => {
-  expect(Math.cbrt).toHaveLength(1);
+    expect(Math.cbrt).toHaveLength(1);
 
-  expect(Math.cbrt(NaN)).toBeNaN();
-  // FIXME: expect(Math.cbrt(-1)).toBe(-1);
-  expect(Math.cbrt(-0)).toBe(-0);
-  // FIXME: expect(Math.cbrt(-Infinity)).toBe(-Infinity);
-  // FIXME: expect(Math.cbrt(1)).toBe(1);
-  // FIXME: expect(Math.cbrt(Infinity)).toBe(Infinity);
-  expect(Math.cbrt(null)).toBe(0);
-  // FIXME: expect(Math.cbrt(2)).toBeCloseTo(1.259921));
+    expect(Math.cbrt(NaN)).toBeNaN();
+    // FIXME: expect(Math.cbrt(-1)).toBe(-1);
+    expect(Math.cbrt(-0)).toBe(-0);
+    // FIXME: expect(Math.cbrt(-Infinity)).toBe(-Infinity);
+    // FIXME: expect(Math.cbrt(1)).toBe(1);
+    // FIXME: expect(Math.cbrt(Infinity)).toBe(Infinity);
+    expect(Math.cbrt(null)).toBe(0);
+    // FIXME: expect(Math.cbrt(2)).toBeCloseTo(1.259921));
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Math/Math.ceil.js

@@ -1,13 +1,13 @@
 test("basic functionality", () => {
-  expect(Math.ceil).toHaveLength(1);
+    expect(Math.ceil).toHaveLength(1);
 
-  expect(Math.ceil(0.95)).toBe(1);
-  expect(Math.ceil(4)).toBe(4);
-  expect(Math.ceil(7.004)).toBe(8);
-  expect(Math.ceil(-0.95)).toBe(-0);
-  expect(Math.ceil(-4)).toBe(-4);
-  expect(Math.ceil(-7.004)).toBe(-7);
+    expect(Math.ceil(0.95)).toBe(1);
+    expect(Math.ceil(4)).toBe(4);
+    expect(Math.ceil(7.004)).toBe(8);
+    expect(Math.ceil(-0.95)).toBe(-0);
+    expect(Math.ceil(-4)).toBe(-4);
+    expect(Math.ceil(-7.004)).toBe(-7);
 
-  expect(Math.ceil()).toBeNaN();
-  expect(Math.ceil(NaN)).toBeNaN();
+    expect(Math.ceil()).toBeNaN();
+    expect(Math.ceil(NaN)).toBeNaN();
 });

+ 40 - 40
Libraries/LibJS/Tests/builtins/Math/Math.clz32.js

@@ -1,44 +1,44 @@
 test("basic functionality", () => {
-  expect(Math.clz32).toHaveLength(1);
+    expect(Math.clz32).toHaveLength(1);
 
-  expect(Math.clz32(0)).toBe(32);
-  expect(Math.clz32(1)).toBe(31);
-  expect(Math.clz32(2)).toBe(30);
-  expect(Math.clz32(3)).toBe(30);
-  expect(Math.clz32(4)).toBe(29);
-  expect(Math.clz32(5)).toBe(29);
-  expect(Math.clz32(-1)).toBe(0);
-  expect(Math.clz32(-10)).toBe(0);
-  expect(Math.clz32(-100)).toBe(0);
-  expect(Math.clz32(-1000)).toBe(0);
-  expect(Math.clz32(-0.123)).toBe(32);
-  expect(Math.clz32(0.123)).toBe(32);
-  expect(Math.clz32(1.23)).toBe(31);
-  expect(Math.clz32(12)).toBe(28);
-  expect(Math.clz32(123)).toBe(25);
-  expect(Math.clz32(1234)).toBe(21);
-  expect(Math.clz32(12345)).toBe(18);
-  expect(Math.clz32(123456)).toBe(15);
-  expect(Math.clz32(1234567)).toBe(11);
-  expect(Math.clz32(12345678)).toBe(8);
-  expect(Math.clz32(123456789)).toBe(5);
-  expect(Math.clz32(999999999)).toBe(2);
-  expect(Math.clz32(9999999999)).toBe(1);
-  expect(Math.clz32(99999999999)).toBe(1);
-  expect(Math.clz32(999999999999)).toBe(0);
-  expect(Math.clz32(9999999999999)).toBe(1);
-  expect(Math.clz32(99999999999999)).toBe(3);
-  expect(Math.clz32(999999999999999)).toBe(0);
+    expect(Math.clz32(0)).toBe(32);
+    expect(Math.clz32(1)).toBe(31);
+    expect(Math.clz32(2)).toBe(30);
+    expect(Math.clz32(3)).toBe(30);
+    expect(Math.clz32(4)).toBe(29);
+    expect(Math.clz32(5)).toBe(29);
+    expect(Math.clz32(-1)).toBe(0);
+    expect(Math.clz32(-10)).toBe(0);
+    expect(Math.clz32(-100)).toBe(0);
+    expect(Math.clz32(-1000)).toBe(0);
+    expect(Math.clz32(-0.123)).toBe(32);
+    expect(Math.clz32(0.123)).toBe(32);
+    expect(Math.clz32(1.23)).toBe(31);
+    expect(Math.clz32(12)).toBe(28);
+    expect(Math.clz32(123)).toBe(25);
+    expect(Math.clz32(1234)).toBe(21);
+    expect(Math.clz32(12345)).toBe(18);
+    expect(Math.clz32(123456)).toBe(15);
+    expect(Math.clz32(1234567)).toBe(11);
+    expect(Math.clz32(12345678)).toBe(8);
+    expect(Math.clz32(123456789)).toBe(5);
+    expect(Math.clz32(999999999)).toBe(2);
+    expect(Math.clz32(9999999999)).toBe(1);
+    expect(Math.clz32(99999999999)).toBe(1);
+    expect(Math.clz32(999999999999)).toBe(0);
+    expect(Math.clz32(9999999999999)).toBe(1);
+    expect(Math.clz32(99999999999999)).toBe(3);
+    expect(Math.clz32(999999999999999)).toBe(0);
 
-  expect(Math.clz32()).toBe(32);
-  expect(Math.clz32(NaN)).toBe(32);
-  expect(Math.clz32(Infinity)).toBe(32);
-  expect(Math.clz32(-Infinity)).toBe(32);
-  expect(Math.clz32(false)).toBe(32);
-  expect(Math.clz32(true)).toBe(31);
-  expect(Math.clz32(null)).toBe(32);
-  expect(Math.clz32(undefined)).toBe(32);
-  expect(Math.clz32([])).toBe(32);
-  expect(Math.clz32({})).toBe(32);
-  expect(Math.clz32("foo")).toBe(32);
+    expect(Math.clz32()).toBe(32);
+    expect(Math.clz32(NaN)).toBe(32);
+    expect(Math.clz32(Infinity)).toBe(32);
+    expect(Math.clz32(-Infinity)).toBe(32);
+    expect(Math.clz32(false)).toBe(32);
+    expect(Math.clz32(true)).toBe(31);
+    expect(Math.clz32(null)).toBe(32);
+    expect(Math.clz32(undefined)).toBe(32);
+    expect(Math.clz32([])).toBe(32);
+    expect(Math.clz32({})).toBe(32);
+    expect(Math.clz32("foo")).toBe(32);
 });

+ 11 - 11
Libraries/LibJS/Tests/builtins/Math/Math.cos.js

@@ -1,14 +1,14 @@
 test("basic functionality", () => {
-  expect(Math.cos).toHaveLength(1);
+    expect(Math.cos).toHaveLength(1);
 
-  expect(Math.cos(0)).toBe(1);
-  expect(Math.cos(null)).toBe(1);
-  expect(Math.cos("")).toBe(1);
-  expect(Math.cos([])).toBe(1);
-  expect(Math.cos(Math.PI)).toBe(-1);
-  expect(Math.cos()).toBeNaN();
-  expect(Math.cos(undefined)).toBeNaN();
-  expect(Math.cos([1, 2, 3])).toBeNaN();
-  expect(Math.cos({})).toBeNaN();
-  expect(Math.cos("foo")).toBeNaN();
+    expect(Math.cos(0)).toBe(1);
+    expect(Math.cos(null)).toBe(1);
+    expect(Math.cos("")).toBe(1);
+    expect(Math.cos([])).toBe(1);
+    expect(Math.cos(Math.PI)).toBe(-1);
+    expect(Math.cos()).toBeNaN();
+    expect(Math.cos(undefined)).toBeNaN();
+    expect(Math.cos([1, 2, 3])).toBeNaN();
+    expect(Math.cos({})).toBeNaN();
+    expect(Math.cos("foo")).toBeNaN();
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Math/Math.exp.js

@@ -1,13 +1,13 @@
 test("basic functionality", () => {
-  expect(Math.exp).toHaveLength(1);
+    expect(Math.exp).toHaveLength(1);
 
-  expect(Math.exp(0)).toBe(1);
-  expect(Math.exp(-2)).toBeCloseTo(0.135335);
-  expect(Math.exp(-1)).toBeCloseTo(0.367879);
-  expect(Math.exp(1)).toBeCloseTo(2.718281);
-  expect(Math.exp(2)).toBeCloseTo(7.389056);
+    expect(Math.exp(0)).toBe(1);
+    expect(Math.exp(-2)).toBeCloseTo(0.135335);
+    expect(Math.exp(-1)).toBeCloseTo(0.367879);
+    expect(Math.exp(1)).toBeCloseTo(2.718281);
+    expect(Math.exp(2)).toBeCloseTo(7.389056);
 
-  expect(Math.exp()).toBeNaN();
-  expect(Math.exp(undefined)).toBeNaN();
-  expect(Math.exp("foo")).toBeNaN();
+    expect(Math.exp()).toBeNaN();
+    expect(Math.exp(undefined)).toBeNaN();
+    expect(Math.exp("foo")).toBeNaN();
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Math/Math.expm1.js

@@ -1,13 +1,13 @@
 test("basic functionality", () => {
-  expect(Math.expm1).toHaveLength(1);
+    expect(Math.expm1).toHaveLength(1);
 
-  expect(Math.expm1(0)).toBe(0);
-  expect(Math.expm1(-2)).toBeCloseTo(-0.864664);
-  expect(Math.expm1(-1)).toBeCloseTo(-0.63212);
-  expect(Math.expm1(1)).toBeCloseTo(1.718281);
-  expect(Math.expm1(2)).toBeCloseTo(6.389056);
+    expect(Math.expm1(0)).toBe(0);
+    expect(Math.expm1(-2)).toBeCloseTo(-0.864664);
+    expect(Math.expm1(-1)).toBeCloseTo(-0.63212);
+    expect(Math.expm1(1)).toBeCloseTo(1.718281);
+    expect(Math.expm1(2)).toBeCloseTo(6.389056);
 
-  expect(Math.expm1()).toBeNaN();
-  expect(Math.expm1(undefined)).toBeNaN();
-  expect(Math.expm1("foo")).toBeNaN();
+    expect(Math.expm1()).toBeNaN();
+    expect(Math.expm1(undefined)).toBeNaN();
+    expect(Math.expm1("foo")).toBeNaN();
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Math/Math.floor.js

@@ -1,13 +1,13 @@
 test("basic functionality", () => {
-  expect(Math.floor).toHaveLength(1);
+    expect(Math.floor).toHaveLength(1);
 
-  expect(Math.floor(0.95)).toBe(0);
-  expect(Math.floor(4)).toBe(4);
-  expect(Math.floor(7.004)).toBe(7);
-  expect(Math.floor(-0.95)).toBe(-1);
-  expect(Math.floor(-4)).toBe(-4);
-  expect(Math.floor(-7.004)).toBe(-8);
+    expect(Math.floor(0.95)).toBe(0);
+    expect(Math.floor(4)).toBe(4);
+    expect(Math.floor(7.004)).toBe(7);
+    expect(Math.floor(-0.95)).toBe(-1);
+    expect(Math.floor(-4)).toBe(-4);
+    expect(Math.floor(-7.004)).toBe(-8);
 
-  expect(Math.floor()).toBeNaN();
-  expect(Math.floor(NaN)).toBeNaN();
+    expect(Math.floor()).toBeNaN();
+    expect(Math.floor(NaN)).toBeNaN();
 });

+ 5 - 5
Libraries/LibJS/Tests/builtins/Math/Math.log1p.js

@@ -1,8 +1,8 @@
 test("basic functionality", () => {
-  expect(Math.log1p).toHaveLength(1);
+    expect(Math.log1p).toHaveLength(1);
 
-  expect(Math.log1p(-2)).toBeNaN();
-  expect(Math.log1p(-1)).toBe(-Infinity);
-  // FIXME: expect(Math.log1p(0)).toBe(0);
-  // FIXME: expect(Math.log1p(1)).toBeCloseTo(0.693147);
+    expect(Math.log1p(-2)).toBeNaN();
+    expect(Math.log1p(-1)).toBe(-Infinity);
+    // FIXME: expect(Math.log1p(0)).toBe(0);
+    // FIXME: expect(Math.log1p(1)).toBeCloseTo(0.693147);
 });

+ 7 - 7
Libraries/LibJS/Tests/builtins/Math/Math.max.js

@@ -1,10 +1,10 @@
 test("basic functionality", () => {
-  expect(Math.max).toHaveLength(2);
+    expect(Math.max).toHaveLength(2);
 
-  expect(Math.max()).toBe(-Infinity);
-  expect(Math.max(1)).toBe(1);
-  expect(Math.max(2, 1)).toBe(2);
-  expect(Math.max(1, 2, 3)).toBe(3);
-  expect(Math.max(NaN)).toBeNaN();
-  expect(Math.max("String", 1)).toBeNaN();
+    expect(Math.max()).toBe(-Infinity);
+    expect(Math.max(1)).toBe(1);
+    expect(Math.max(2, 1)).toBe(2);
+    expect(Math.max(1, 2, 3)).toBe(3);
+    expect(Math.max(NaN)).toBeNaN();
+    expect(Math.max("String", 1)).toBeNaN();
 });

+ 6 - 6
Libraries/LibJS/Tests/builtins/Math/Math.min.js

@@ -1,9 +1,9 @@
 test("basic functionality", () => {
-  expect(Math.min).toHaveLength(2);
+    expect(Math.min).toHaveLength(2);
 
-  expect(Math.min(1)).toBe(1);
-  expect(Math.min(2, 1)).toBe(1);
-  expect(Math.min(1, 2, 3)).toBe(1);
-  expect(Math.min(NaN)).toBeNaN();
-  expect(Math.min("String", 1)).toBeNaN();
+    expect(Math.min(1)).toBe(1);
+    expect(Math.min(2, 1)).toBe(1);
+    expect(Math.min(1, 2, 3)).toBe(1);
+    expect(Math.min(NaN)).toBeNaN();
+    expect(Math.min("String", 1)).toBeNaN();
 });

+ 22 - 22
Libraries/LibJS/Tests/builtins/Math/Math.pow.js

@@ -1,25 +1,25 @@
 test("basic functionality", () => {
-  expect(Math.pow).toHaveLength(2);
+    expect(Math.pow).toHaveLength(2);
 
-  expect(Math.pow(2, 0)).toBe(1);
-  expect(Math.pow(2, 1)).toBe(2);
-  expect(Math.pow(2, 2)).toBe(4);
-  expect(Math.pow(2, 3)).toBe(8);
-  expect(Math.pow(2, -3)).toBe(0.125);
-  expect(Math.pow(3, 2)).toBe(9);
-  expect(Math.pow(0, 0)).toBe(1);
-  expect(Math.pow(2, Math.pow(3, 2))).toBe(512);
-  expect(Math.pow(Math.pow(2, 3), 2)).toBe(64);
-  expect(Math.pow("2", "3")).toBe(8);
-  expect(Math.pow("", [])).toBe(1);
-  expect(Math.pow([], null)).toBe(1);
-  expect(Math.pow(null, null)).toBe(1);
-  expect(Math.pow(undefined, null)).toBe(1);
-  expect(Math.pow(NaN, 2)).toBeNaN();
-  expect(Math.pow(2, NaN)).toBeNaN();
-  expect(Math.pow(undefined, 2)).toBeNaN();
-  expect(Math.pow(2, undefined)).toBeNaN();
-  expect(Math.pow(null, undefined)).toBeNaN();
-  expect(Math.pow(2, "foo")).toBeNaN();
-  expect(Math.pow("foo", 2)).toBeNaN();
+    expect(Math.pow(2, 0)).toBe(1);
+    expect(Math.pow(2, 1)).toBe(2);
+    expect(Math.pow(2, 2)).toBe(4);
+    expect(Math.pow(2, 3)).toBe(8);
+    expect(Math.pow(2, -3)).toBe(0.125);
+    expect(Math.pow(3, 2)).toBe(9);
+    expect(Math.pow(0, 0)).toBe(1);
+    expect(Math.pow(2, Math.pow(3, 2))).toBe(512);
+    expect(Math.pow(Math.pow(2, 3), 2)).toBe(64);
+    expect(Math.pow("2", "3")).toBe(8);
+    expect(Math.pow("", [])).toBe(1);
+    expect(Math.pow([], null)).toBe(1);
+    expect(Math.pow(null, null)).toBe(1);
+    expect(Math.pow(undefined, null)).toBe(1);
+    expect(Math.pow(NaN, 2)).toBeNaN();
+    expect(Math.pow(2, NaN)).toBeNaN();
+    expect(Math.pow(undefined, 2)).toBeNaN();
+    expect(Math.pow(2, undefined)).toBeNaN();
+    expect(Math.pow(null, undefined)).toBeNaN();
+    expect(Math.pow(2, "foo")).toBeNaN();
+    expect(Math.pow("foo", 2)).toBeNaN();
 });

+ 25 - 25
Libraries/LibJS/Tests/builtins/Math/Math.sign.js

@@ -1,36 +1,36 @@
 function isPositiveZero(value) {
-  return value === 0 && 1 / value === Infinity;
+    return value === 0 && 1 / value === Infinity;
 }
 
 function isNegativeZero(value) {
-  return value === 0 && 1 / value === -Infinity;
+    return value === 0 && 1 / value === -Infinity;
 }
 
 test("basic functionality", () => {
-  expect(Math.sign).toHaveLength(1);
+    expect(Math.sign).toHaveLength(1);
 
-  expect(Math.sign(0.0001)).toBe(1);
-  expect(Math.sign(1)).toBe(1);
-  expect(Math.sign(42)).toBe(1);
-  expect(Math.sign(Infinity)).toBe(1);
-  expect(isPositiveZero(Math.sign(0))).toBeTrue();
-  expect(isPositiveZero(Math.sign(null))).toBeTrue();
-  expect(isPositiveZero(Math.sign(""))).toBeTrue();
-  expect(isPositiveZero(Math.sign([]))).toBeTrue();
+    expect(Math.sign(0.0001)).toBe(1);
+    expect(Math.sign(1)).toBe(1);
+    expect(Math.sign(42)).toBe(1);
+    expect(Math.sign(Infinity)).toBe(1);
+    expect(isPositiveZero(Math.sign(0))).toBeTrue();
+    expect(isPositiveZero(Math.sign(null))).toBeTrue();
+    expect(isPositiveZero(Math.sign(""))).toBeTrue();
+    expect(isPositiveZero(Math.sign([]))).toBeTrue();
 
-  expect(Math.sign(-0.0001)).toBe(-1);
-  expect(Math.sign(-1)).toBe(-1);
-  expect(Math.sign(-42)).toBe(-1);
-  expect(Math.sign(-Infinity)).toBe(-1);
-  expect(isNegativeZero(Math.sign(-0))).toBeTrue();
-  expect(isNegativeZero(Math.sign(-null))).toBeTrue();
-  expect(isNegativeZero(Math.sign(-""))).toBeTrue();
-  expect(isNegativeZero(Math.sign(-[]))).toBeTrue();
+    expect(Math.sign(-0.0001)).toBe(-1);
+    expect(Math.sign(-1)).toBe(-1);
+    expect(Math.sign(-42)).toBe(-1);
+    expect(Math.sign(-Infinity)).toBe(-1);
+    expect(isNegativeZero(Math.sign(-0))).toBeTrue();
+    expect(isNegativeZero(Math.sign(-null))).toBeTrue();
+    expect(isNegativeZero(Math.sign(-""))).toBeTrue();
+    expect(isNegativeZero(Math.sign(-[]))).toBeTrue();
 
-  expect(Math.sign()).toBeNaN();
-  expect(Math.sign(undefined)).toBeNaN();
-  expect(Math.sign([1, 2, 3])).toBeNaN();
-  expect(Math.sign({})).toBeNaN();
-  expect(Math.sign(NaN)).toBeNaN();
-  expect(Math.sign("foo")).toBeNaN();
+    expect(Math.sign()).toBeNaN();
+    expect(Math.sign(undefined)).toBeNaN();
+    expect(Math.sign([1, 2, 3])).toBeNaN();
+    expect(Math.sign({})).toBeNaN();
+    expect(Math.sign(NaN)).toBeNaN();
+    expect(Math.sign("foo")).toBeNaN();
 });

+ 12 - 12
Libraries/LibJS/Tests/builtins/Math/Math.sin.js

@@ -1,15 +1,15 @@
 test("basic functionality", () => {
-  expect(Math.sin).toHaveLength(1);
+    expect(Math.sin).toHaveLength(1);
 
-  expect(Math.sin(0)).toBe(0);
-  expect(Math.sin(null)).toBe(0);
-  expect(Math.sin("")).toBe(0);
-  expect(Math.sin([])).toBe(0);
-  expect(Math.sin((Math.PI * 3) / 2)).toBe(-1);
-  expect(Math.sin(Math.PI / 2)).toBe(1);
-  expect(Math.sin()).toBeNaN();
-  expect(Math.sin(undefined)).toBeNaN();
-  expect(Math.sin([1, 2, 3])).toBeNaN();
-  expect(Math.sin({})).toBeNaN();
-  expect(Math.sin("foo")).toBeNaN();
+    expect(Math.sin(0)).toBe(0);
+    expect(Math.sin(null)).toBe(0);
+    expect(Math.sin("")).toBe(0);
+    expect(Math.sin([])).toBe(0);
+    expect(Math.sin((Math.PI * 3) / 2)).toBe(-1);
+    expect(Math.sin(Math.PI / 2)).toBe(1);
+    expect(Math.sin()).toBeNaN();
+    expect(Math.sin(undefined)).toBeNaN();
+    expect(Math.sin([1, 2, 3])).toBeNaN();
+    expect(Math.sin({})).toBeNaN();
+    expect(Math.sin("foo")).toBeNaN();
 });

+ 2 - 2
Libraries/LibJS/Tests/builtins/Math/Math.sqrt.js

@@ -1,4 +1,4 @@
 test("basic functionality", () => {
-  expect(Math.sqrt).toHaveLength(1);
-  expect(Math.sqrt(9)).toBe(3);
+    expect(Math.sqrt).toHaveLength(1);
+    expect(Math.sqrt(9)).toBe(3);
 });

+ 11 - 11
Libraries/LibJS/Tests/builtins/Math/Math.tan.js

@@ -1,14 +1,14 @@
 test("basic functionality", () => {
-  expect(Math.tan).toHaveLength(1);
+    expect(Math.tan).toHaveLength(1);
 
-  expect(Math.tan(0)).toBe(0);
-  expect(Math.tan(null)).toBe(0);
-  expect(Math.tan("")).toBe(0);
-  expect(Math.tan([])).toBe(0);
-  expect(Math.ceil(Math.tan(Math.PI / 4))).toBe(1);
-  expect(Math.tan()).toBeNaN();
-  expect(Math.tan(undefined)).toBeNaN();
-  expect(Math.tan([1, 2, 3])).toBeNaN();
-  expect(Math.tan({})).toBeNaN();
-  expect(Math.tan("foo")).toBeNaN();
+    expect(Math.tan(0)).toBe(0);
+    expect(Math.tan(null)).toBe(0);
+    expect(Math.tan("")).toBe(0);
+    expect(Math.tan([])).toBe(0);
+    expect(Math.ceil(Math.tan(Math.PI / 4))).toBe(1);
+    expect(Math.tan()).toBeNaN();
+    expect(Math.tan(undefined)).toBeNaN();
+    expect(Math.tan([1, 2, 3])).toBeNaN();
+    expect(Math.tan({})).toBeNaN();
+    expect(Math.tan("foo")).toBeNaN();
 });

+ 8 - 8
Libraries/LibJS/Tests/builtins/Math/Math.trunc.js

@@ -1,12 +1,12 @@
 test("basic functionality", () => {
-  expect(Math.trunc).toHaveLength(1);
+    expect(Math.trunc).toHaveLength(1);
 
-  expect(Math.trunc(13.37)).toBe(13);
-  expect(Math.trunc(42.84)).toBe(42);
-  expect(Math.trunc(0.123)).toBe(0);
-  expect(Math.trunc(-0.123)).toBe(-0);
+    expect(Math.trunc(13.37)).toBe(13);
+    expect(Math.trunc(42.84)).toBe(42);
+    expect(Math.trunc(0.123)).toBe(0);
+    expect(Math.trunc(-0.123)).toBe(-0);
 
-  expect(Math.trunc(NaN)).toBeNaN();
-  expect(Math.trunc("foo")).toBeNaN();
-  expect(Math.trunc()).toBeNaN();
+    expect(Math.trunc(NaN)).toBeNaN();
+    expect(Math.trunc("foo")).toBeNaN();
+    expect(Math.trunc()).toBeNaN();
 });

+ 10 - 10
Libraries/LibJS/Tests/builtins/NaN/NaN.js

@@ -1,13 +1,13 @@
 test("basic functionality", () => {
-  const nan = undefined + 1;
+    const nan = undefined + 1;
 
-  expect(nan + "").toBe("NaN");
-  expect(NaN + "").toBe("NaN");
-  expect(nan !== nan).toBeTrue();
-  expect(NaN !== NaN).toBeTrue();
-  expect(nan).toBeNaN();
-  expect(NaN).toBeNaN();
-  expect(0).not.toBeNaN();
-  expect(!!nan).toBeFalse();
-  expect(!!NaN).toBeFalse();
+    expect(nan + "").toBe("NaN");
+    expect(NaN + "").toBe("NaN");
+    expect(nan !== nan).toBeTrue();
+    expect(NaN !== NaN).toBeTrue();
+    expect(nan).toBeNaN();
+    expect(NaN).toBeNaN();
+    expect(0).not.toBeNaN();
+    expect(!!nan).toBeFalse();
+    expect(!!NaN).toBeFalse();
 });

+ 9 - 9
Libraries/LibJS/Tests/builtins/Number/Number-constants.js

@@ -1,11 +1,11 @@
 test("basic functionality", () => {
-  expect(Number.EPSILON).toBe(2 ** -52);
-  expect(Number.EPSILON).toBeGreaterThan(0);
-  expect(Number.MAX_SAFE_INTEGER).toBe(2 ** 53 - 1);
-  expect(Number.MAX_SAFE_INTEGER + 1).toBe(Number.MAX_SAFE_INTEGER + 2);
-  expect(Number.MIN_SAFE_INTEGER).toBe(-(2 ** 53 - 1));
-  expect(Number.MIN_SAFE_INTEGER - 1).toBe(Number.MIN_SAFE_INTEGER - 2);
-  expect(Number.POSITIVE_INFINITY).toBe(Infinity);
-  expect(Number.NEGATIVE_INFINITY).toBe(-Infinity);
-  expect(Number.NaN).toBeNaN();
+    expect(Number.EPSILON).toBe(2 ** -52);
+    expect(Number.EPSILON).toBeGreaterThan(0);
+    expect(Number.MAX_SAFE_INTEGER).toBe(2 ** 53 - 1);
+    expect(Number.MAX_SAFE_INTEGER + 1).toBe(Number.MAX_SAFE_INTEGER + 2);
+    expect(Number.MIN_SAFE_INTEGER).toBe(-(2 ** 53 - 1));
+    expect(Number.MIN_SAFE_INTEGER - 1).toBe(Number.MIN_SAFE_INTEGER - 2);
+    expect(Number.POSITIVE_INFINITY).toBe(Infinity);
+    expect(Number.NEGATIVE_INFINITY).toBe(-Infinity);
+    expect(Number.NaN).toBeNaN();
 });

+ 20 - 20
Libraries/LibJS/Tests/builtins/Number/Number.isFinite.js

@@ -1,24 +1,24 @@
 test("basic functionality", () => {
-  expect(Number.isFinite).toHaveLength(1);
-  expect(Number.isFinite).not.toBe(isFinite);
+    expect(Number.isFinite).toHaveLength(1);
+    expect(Number.isFinite).not.toBe(isFinite);
 
-  expect(Number.isFinite(0)).toBeTrue();
-  expect(Number.isFinite(1.23)).toBeTrue();
-  expect(Number.isFinite(42)).toBeTrue();
+    expect(Number.isFinite(0)).toBeTrue();
+    expect(Number.isFinite(1.23)).toBeTrue();
+    expect(Number.isFinite(42)).toBeTrue();
 
-  expect(Number.isFinite("")).toBeFalse();
-  expect(Number.isFinite("0")).toBeFalse();
-  expect(Number.isFinite("42")).toBeFalse();
-  expect(Number.isFinite(true)).toBeFalse();
-  expect(Number.isFinite(false)).toBeFalse();
-  expect(Number.isFinite(null)).toBeFalse();
-  expect(Number.isFinite([])).toBeFalse();
-  expect(Number.isFinite()).toBeFalse();
-  expect(Number.isFinite(NaN)).toBeFalse();
-  expect(Number.isFinite(undefined)).toBeFalse();
-  expect(Number.isFinite(Infinity)).toBeFalse();
-  expect(Number.isFinite(-Infinity)).toBeFalse();
-  expect(Number.isFinite("foo")).toBeFalse();
-  expect(Number.isFinite({})).toBeFalse();
-  expect(Number.isFinite([1, 2, 3])).toBeFalse();
+    expect(Number.isFinite("")).toBeFalse();
+    expect(Number.isFinite("0")).toBeFalse();
+    expect(Number.isFinite("42")).toBeFalse();
+    expect(Number.isFinite(true)).toBeFalse();
+    expect(Number.isFinite(false)).toBeFalse();
+    expect(Number.isFinite(null)).toBeFalse();
+    expect(Number.isFinite([])).toBeFalse();
+    expect(Number.isFinite()).toBeFalse();
+    expect(Number.isFinite(NaN)).toBeFalse();
+    expect(Number.isFinite(undefined)).toBeFalse();
+    expect(Number.isFinite(Infinity)).toBeFalse();
+    expect(Number.isFinite(-Infinity)).toBeFalse();
+    expect(Number.isFinite("foo")).toBeFalse();
+    expect(Number.isFinite({})).toBeFalse();
+    expect(Number.isFinite([1, 2, 3])).toBeFalse();
 });

+ 28 - 28
Libraries/LibJS/Tests/builtins/Number/Number.isInteger.js

@@ -1,32 +1,32 @@
 test("basic functionality", () => {
-  expect(Number.isInteger).toHaveLength(1);
+    expect(Number.isInteger).toHaveLength(1);
 
-  expect(Number.isInteger(0)).toBeTrue();
-  expect(Number.isInteger(42)).toBeTrue();
-  expect(Number.isInteger(-10000)).toBeTrue();
-  expect(Number.isInteger(5)).toBeTrue();
-  expect(Number.isInteger(5.0)).toBeTrue();
-  expect(Number.isInteger(5 + 1 / 10000000000000000)).toBeTrue();
-  // FIXME: values outside of i32's range should still return true
-  // expect(Number.isInteger(+2147483647 + 1)).toBeTrue();
-  // expect(Number.isInteger(-2147483648 - 1)).toBeTrue();
-  // expect(Number.isInteger(99999999999999999999999999999999999)).toBeTrue();
+    expect(Number.isInteger(0)).toBeTrue();
+    expect(Number.isInteger(42)).toBeTrue();
+    expect(Number.isInteger(-10000)).toBeTrue();
+    expect(Number.isInteger(5)).toBeTrue();
+    expect(Number.isInteger(5.0)).toBeTrue();
+    expect(Number.isInteger(5 + 1 / 10000000000000000)).toBeTrue();
+    // FIXME: values outside of i32's range should still return true
+    // expect(Number.isInteger(+2147483647 + 1)).toBeTrue();
+    // expect(Number.isInteger(-2147483648 - 1)).toBeTrue();
+    // expect(Number.isInteger(99999999999999999999999999999999999)).toBeTrue();
 
-  expect(Number.isInteger(5 + 1 / 1000000000000000)).toBeFalse();
-  expect(Number.isInteger(1.23)).toBeFalse();
-  expect(Number.isInteger("")).toBeFalse();
-  expect(Number.isInteger("0")).toBeFalse();
-  expect(Number.isInteger("42")).toBeFalse();
-  expect(Number.isInteger(true)).toBeFalse();
-  expect(Number.isInteger(false)).toBeFalse();
-  expect(Number.isInteger(null)).toBeFalse();
-  expect(Number.isInteger([])).toBeFalse();
-  expect(Number.isInteger(Infinity)).toBeFalse();
-  expect(Number.isInteger(-Infinity)).toBeFalse();
-  expect(Number.isInteger(NaN)).toBeFalse();
-  expect(Number.isInteger()).toBeFalse();
-  expect(Number.isInteger(undefined)).toBeFalse();
-  expect(Number.isInteger("foo")).toBeFalse();
-  expect(Number.isInteger({})).toBeFalse();
-  expect(Number.isInteger([1, 2, 3])).toBeFalse();
+    expect(Number.isInteger(5 + 1 / 1000000000000000)).toBeFalse();
+    expect(Number.isInteger(1.23)).toBeFalse();
+    expect(Number.isInteger("")).toBeFalse();
+    expect(Number.isInteger("0")).toBeFalse();
+    expect(Number.isInteger("42")).toBeFalse();
+    expect(Number.isInteger(true)).toBeFalse();
+    expect(Number.isInteger(false)).toBeFalse();
+    expect(Number.isInteger(null)).toBeFalse();
+    expect(Number.isInteger([])).toBeFalse();
+    expect(Number.isInteger(Infinity)).toBeFalse();
+    expect(Number.isInteger(-Infinity)).toBeFalse();
+    expect(Number.isInteger(NaN)).toBeFalse();
+    expect(Number.isInteger()).toBeFalse();
+    expect(Number.isInteger(undefined)).toBeFalse();
+    expect(Number.isInteger("foo")).toBeFalse();
+    expect(Number.isInteger({})).toBeFalse();
+    expect(Number.isInteger([1, 2, 3])).toBeFalse();
 });

+ 21 - 21
Libraries/LibJS/Tests/builtins/Number/Number.isNaN.js

@@ -1,25 +1,25 @@
 test("basic functionality", () => {
-  expect(Number.isNaN).toHaveLength(1);
-  expect(Number.isNaN).not.toBe(isNaN);
+    expect(Number.isNaN).toHaveLength(1);
+    expect(Number.isNaN).not.toBe(isNaN);
 
-  expect(Number.isNaN(0)).toBeFalse();
-  expect(Number.isNaN(42)).toBeFalse();
-  expect(Number.isNaN("")).toBeFalse();
-  expect(Number.isNaN("0")).toBeFalse();
-  expect(Number.isNaN("42")).toBeFalse();
-  expect(Number.isNaN(true)).toBeFalse();
-  expect(Number.isNaN(false)).toBeFalse();
-  expect(Number.isNaN(null)).toBeFalse();
-  expect(Number.isNaN([])).toBeFalse();
-  expect(Number.isNaN(Infinity)).toBeFalse();
-  expect(Number.isNaN(-Infinity)).toBeFalse();
-  expect(Number.isNaN()).toBeFalse();
-  expect(Number.isNaN(undefined)).toBeFalse();
-  expect(Number.isNaN("foo")).toBeFalse();
-  expect(Number.isNaN({})).toBeFalse();
-  expect(Number.isNaN([1, 2, 3])).toBeFalse();
+    expect(Number.isNaN(0)).toBeFalse();
+    expect(Number.isNaN(42)).toBeFalse();
+    expect(Number.isNaN("")).toBeFalse();
+    expect(Number.isNaN("0")).toBeFalse();
+    expect(Number.isNaN("42")).toBeFalse();
+    expect(Number.isNaN(true)).toBeFalse();
+    expect(Number.isNaN(false)).toBeFalse();
+    expect(Number.isNaN(null)).toBeFalse();
+    expect(Number.isNaN([])).toBeFalse();
+    expect(Number.isNaN(Infinity)).toBeFalse();
+    expect(Number.isNaN(-Infinity)).toBeFalse();
+    expect(Number.isNaN()).toBeFalse();
+    expect(Number.isNaN(undefined)).toBeFalse();
+    expect(Number.isNaN("foo")).toBeFalse();
+    expect(Number.isNaN({})).toBeFalse();
+    expect(Number.isNaN([1, 2, 3])).toBeFalse();
 
-  expect(Number.isNaN(NaN)).toBeTrue();
-  expect(Number.isNaN(Number.NaN)).toBeTrue();
-  expect(Number.isNaN(0 / 0)).toBeTrue();
+    expect(Number.isNaN(NaN)).toBeTrue();
+    expect(Number.isNaN(Number.NaN)).toBeTrue();
+    expect(Number.isNaN(0 / 0)).toBeTrue();
 });

+ 20 - 20
Libraries/LibJS/Tests/builtins/Number/Number.isSafeInteger.js

@@ -1,24 +1,24 @@
 test("basic functionality", () => {
-  expect(Number.isSafeInteger).toHaveLength(1);
+    expect(Number.isSafeInteger).toHaveLength(1);
 
-  expect(Number.isSafeInteger(0)).toBeTrue();
-  expect(Number.isSafeInteger(1)).toBeTrue();
-  expect(Number.isSafeInteger(2.0)).toBeTrue();
-  expect(Number.isSafeInteger(42)).toBeTrue();
-  expect(Number.isSafeInteger(Number.MAX_SAFE_INTEGER)).toBeTrue();
-  expect(Number.isSafeInteger(Number.MIN_SAFE_INTEGER)).toBeTrue();
+    expect(Number.isSafeInteger(0)).toBeTrue();
+    expect(Number.isSafeInteger(1)).toBeTrue();
+    expect(Number.isSafeInteger(2.0)).toBeTrue();
+    expect(Number.isSafeInteger(42)).toBeTrue();
+    expect(Number.isSafeInteger(Number.MAX_SAFE_INTEGER)).toBeTrue();
+    expect(Number.isSafeInteger(Number.MIN_SAFE_INTEGER)).toBeTrue();
 
-  expect(Number.isSafeInteger()).toBeFalse();
-  expect(Number.isSafeInteger("1")).toBeFalse();
-  expect(Number.isSafeInteger(2.1)).toBeFalse();
-  expect(Number.isSafeInteger(42.42)).toBeFalse();
-  expect(Number.isSafeInteger("")).toBeFalse();
-  expect(Number.isSafeInteger([])).toBeFalse();
-  expect(Number.isSafeInteger(null)).toBeFalse();
-  expect(Number.isSafeInteger(undefined)).toBeFalse();
-  expect(Number.isSafeInteger(NaN)).toBeFalse();
-  expect(Number.isSafeInteger(Infinity)).toBeFalse();
-  expect(Number.isSafeInteger(-Infinity)).toBeFalse();
-  expect(Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 1)).toBeFalse();
-  expect(Number.isSafeInteger(Number.MIN_SAFE_INTEGER - 1)).toBeFalse();
+    expect(Number.isSafeInteger()).toBeFalse();
+    expect(Number.isSafeInteger("1")).toBeFalse();
+    expect(Number.isSafeInteger(2.1)).toBeFalse();
+    expect(Number.isSafeInteger(42.42)).toBeFalse();
+    expect(Number.isSafeInteger("")).toBeFalse();
+    expect(Number.isSafeInteger([])).toBeFalse();
+    expect(Number.isSafeInteger(null)).toBeFalse();
+    expect(Number.isSafeInteger(undefined)).toBeFalse();
+    expect(Number.isSafeInteger(NaN)).toBeFalse();
+    expect(Number.isSafeInteger(Infinity)).toBeFalse();
+    expect(Number.isSafeInteger(-Infinity)).toBeFalse();
+    expect(Number.isSafeInteger(Number.MAX_SAFE_INTEGER + 1)).toBeFalse();
+    expect(Number.isSafeInteger(Number.MIN_SAFE_INTEGER - 1)).toBeFalse();
 });

+ 29 - 29
Libraries/LibJS/Tests/builtins/Number/Number.js

@@ -1,33 +1,33 @@
 test("basic functionality", () => {
-  expect(Number).toHaveLength(1);
-  expect(Number.name).toBe("Number");
-  expect(Number.prototype).not.toHaveProperty("length");
+    expect(Number).toHaveLength(1);
+    expect(Number.name).toBe("Number");
+    expect(Number.prototype).not.toHaveProperty("length");
 
-  expect(typeof Number()).toBe("number");
-  expect(typeof new Number()).toBe("object");
+    expect(typeof Number()).toBe("number");
+    expect(typeof new Number()).toBe("object");
 
-  expect(Number()).toBe(0);
-  expect(new Number().valueOf()).toBe(0);
-  expect(Number("42")).toBe(42);
-  expect(new Number("42").valueOf()).toBe(42);
-  expect(Number(null)).toBe(0);
-  expect(new Number(null).valueOf()).toBe(0);
-  expect(Number(true)).toBe(1);
-  expect(new Number(true).valueOf()).toBe(1);
-  expect(Number("Infinity")).toBe(Infinity);
-  expect(new Number("Infinity").valueOf()).toBe(Infinity);
-  expect(Number("+Infinity")).toBe(Infinity);
-  expect(new Number("+Infinity").valueOf()).toBe(Infinity);
-  expect(Number("-Infinity")).toBe(-Infinity);
-  expect(new Number("-Infinity").valueOf()).toBe(-Infinity);
-  expect(Number(undefined)).toBeNaN();
-  expect(new Number(undefined).valueOf()).toBeNaN();
-  expect(Number({})).toBeNaN();
-  expect(new Number({}).valueOf()).toBeNaN();
-  expect(Number({ a: 1 })).toBeNaN();
-  expect(new Number({ a: 1 }).valueOf()).toBeNaN();
-  expect(Number([1, 2, 3])).toBeNaN();
-  expect(new Number([1, 2, 3]).valueOf()).toBeNaN();
-  expect(Number("foo")).toBeNaN();
-  expect(new Number("foo").valueOf()).toBeNaN();
+    expect(Number()).toBe(0);
+    expect(new Number().valueOf()).toBe(0);
+    expect(Number("42")).toBe(42);
+    expect(new Number("42").valueOf()).toBe(42);
+    expect(Number(null)).toBe(0);
+    expect(new Number(null).valueOf()).toBe(0);
+    expect(Number(true)).toBe(1);
+    expect(new Number(true).valueOf()).toBe(1);
+    expect(Number("Infinity")).toBe(Infinity);
+    expect(new Number("Infinity").valueOf()).toBe(Infinity);
+    expect(Number("+Infinity")).toBe(Infinity);
+    expect(new Number("+Infinity").valueOf()).toBe(Infinity);
+    expect(Number("-Infinity")).toBe(-Infinity);
+    expect(new Number("-Infinity").valueOf()).toBe(-Infinity);
+    expect(Number(undefined)).toBeNaN();
+    expect(new Number(undefined).valueOf()).toBeNaN();
+    expect(Number({})).toBeNaN();
+    expect(new Number({}).valueOf()).toBeNaN();
+    expect(Number({ a: 1 })).toBeNaN();
+    expect(new Number({ a: 1 }).valueOf()).toBeNaN();
+    expect(Number([1, 2, 3])).toBeNaN();
+    expect(new Number([1, 2, 3]).valueOf()).toBeNaN();
+    expect(Number("foo")).toBeNaN();
+    expect(new Number("foo").valueOf()).toBeNaN();
 });

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików