summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-04-29 00:22:47 +0100
committerAndreas Kling <kling@serenityos.org>2020-04-29 09:38:25 +0200
commitd4ec38097f833229f021deadc35d75c433a5231b (patch)
tree58306b891e71820a697eb7a4cc373459d7789289 /Libraries/LibJS/Tests
parenta220236cdea90966e0da64e1c04dee92a9f34ff6 (diff)
downloadserenity-d4ec38097f833229f021deadc35d75c433a5231b.zip
LibJS: Return undefined in Array.prototype.{pop,shift} for empty values
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r--Libraries/LibJS/Tests/Array.prototype.pop.js2
-rw-r--r--Libraries/LibJS/Tests/Array.prototype.shift.js2
2 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/Array.prototype.pop.js b/Libraries/LibJS/Tests/Array.prototype.pop.js
index 9dce8d4c29..a4d09a2311 100644
--- a/Libraries/LibJS/Tests/Array.prototype.pop.js
+++ b/Libraries/LibJS/Tests/Array.prototype.pop.js
@@ -13,6 +13,8 @@ try {
assert(value === undefined);
assert(a.length === 0);
+ assert([,].pop() === undefined);
+
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
diff --git a/Libraries/LibJS/Tests/Array.prototype.shift.js b/Libraries/LibJS/Tests/Array.prototype.shift.js
index 44cb316203..2b48e7bf20 100644
--- a/Libraries/LibJS/Tests/Array.prototype.shift.js
+++ b/Libraries/LibJS/Tests/Array.prototype.shift.js
@@ -13,6 +13,8 @@ try {
assert(value === undefined);
assert(a.length === 0);
+ assert([,].shift() === undefined);
+
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);