浏览代码

LibJS: Add tests for issue #3382

Linus Groh 5 年之前
父节点
当前提交
55c4866370
共有 1 个文件被更改,包括 15 次插入0 次删除
  1. 15 0
      Libraries/LibJS/Tests/builtins/Array/array-simple-and-generic-storage-initialization.js

+ 15 - 0
Libraries/LibJS/Tests/builtins/Array/array-simple-and-generic-storage-initialization.js

@@ -0,0 +1,15 @@
+describe("Issue #3382", () => {
+    test("Creating an array with simple storage (<= 200 initial elements)", () => {
+        var a = Array(200);
+        expect(a).toHaveLength(200);
+        expect(a.push("foo")).toBe(201);
+        expect(a).toHaveLength(201);
+    });
+
+    test("Creating an array with generic storage (> 200 initial elements)", () => {
+        var a = Array(201);
+        expect(a).toHaveLength(201);
+        expect(a.push("foo")).toBe(202);
+        expect(a).toHaveLength(202);
+    });
+});