summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2020-05-07 17:09:00 -0700
committerAndreas Kling <kling@serenityos.org>2020-05-08 09:49:20 +0200
commit532d4bc0abf4f345aed153bb795bb7f7509bee5a (patch)
tree813ff2572fd97a4b14be00fe19668a71f98b6cf8 /Libraries/LibJS/Tests
parentcc01933840d8c8e71f1162a92c8b6758bf30ebd3 (diff)
downloadserenity-532d4bc0abf4f345aed153bb795bb7f7509bee5a.zip
LibJS: Spec-compliant equality comparisons
The ECMAScript spec defines multiple equality operations which are used all over the spec; this patch introduces them. Of course, the two primary equality operations are AbtractEquals ('==') and StrictEquals ('==='), which have been renamed to 'abstract_eq' and 'strict_eq' in this patch. In support of the two operations mentioned above, the following have also been added: SameValue, SameValueZero, and SameValueNonNumeric. These are important to have, because they are used elsewhere in the spec aside from the two primary equality comparisons.
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r--Libraries/LibJS/Tests/switch-basic.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/switch-basic.js b/Libraries/LibJS/Tests/switch-basic.js
index 04bda00717..1fba80f9f0 100644
--- a/Libraries/LibJS/Tests/switch-basic.js
+++ b/Libraries/LibJS/Tests/switch-basic.js
@@ -1,4 +1,8 @@
+load("test-common.js");
+
switch (1 + 2) {
+case '3':
+ assertNotReached();
case 3:
console.log("PASS");
break;