Debian Codegraph @

js/src/tests/test262/annexB/language/statements/switch/emulates-undefined.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-runtime-semantics-caseclauseisselected
5 description: >
6 `switch` statement uses Strict Equality Comparison,
7 which doesn't special-case [[IsHTMLDDA]] objects.
8 info: |
9 Runtime Semantics: CaseClauseIsSelected ( C, input )
10
11 [...]
12 4. Return the result of performing Strict Equality Comparison input === clauseSelector.
13
14 Strict Equality Comparison
15
16 1. If Type(x) is different from Type(y), return false.
17 features: [IsHTMLDDA]
18 ---*/
19
20 var IsHTMLDDA = $262.IsHTMLDDA;
21
22 assert.sameValue(
23 (function() {
24 switch (IsHTMLDDA) {
25 case undefined: return 1;
26 case null: return 2;
27 case IsHTMLDDA: return 3;
28 }
29 })(),
30 3
31 );
32
33 reportCompare(0, 0);