summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/collections/key-equality-NaN.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/collections/key-equality-NaN.js')
-rw-r--r--js/src/jit-test/tests/collections/key-equality-NaN.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/collections/key-equality-NaN.js b/js/src/jit-test/tests/collections/key-equality-NaN.js
new file mode 100644
index 000000000..f26dc0760
--- /dev/null
+++ b/js/src/jit-test/tests/collections/key-equality-NaN.js
@@ -0,0 +1,15 @@
+// NaN is equal to itself for the purpose of key lookups.
+
+var m = new Map;
+m.set(NaN, "ok");
+assertEq(m.has(NaN), true);
+assertEq(m.get(NaN), "ok");
+assertEq(m.delete(NaN), true);
+assertEq(m.has(NaN), false);
+assertEq(m.get(NaN), undefined);
+
+var s = new Set;
+s.add(NaN);
+assertEq(s.has(NaN), true);
+assertEq(s.delete(NaN), true);
+assertEq(s.has(NaN), false);