summaryrefslogtreecommitdiff
path: root/js/src/tests/test262/language/optional-chaining/optional-chain-expression-optional-expression.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/optional-chaining/optional-chain-expression-optional-expression.js')
-rw-r--r--js/src/tests/test262/language/optional-chaining/optional-chain-expression-optional-expression.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/optional-chaining/optional-chain-expression-optional-expression.js b/js/src/tests/test262/language/optional-chaining/optional-chain-expression-optional-expression.js
new file mode 100644
index 000000000..be898b876
--- /dev/null
+++ b/js/src/tests/test262/language/optional-chaining/optional-chain-expression-optional-expression.js
@@ -0,0 +1,22 @@
+// Copyright 2019 Google, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: prod-OptionalExpression
+description: >
+ optional chain bracket notation containing optional expresion
+info: |
+ OptionalChain:
+ ?. [OptionalExpression]
+features: [optional-chaining]
+---*/
+const a = undefined;
+const b = {e: 0};
+const c = {};
+c[undefined] = 11;
+const d = [22];
+
+assert.sameValue(undefined, a?.[a?.b]);
+assert.sameValue(11, c?.[a?.b]);
+assert.sameValue(22, d?.[b?.e]);
+
+reportCompare(0, 0);