diff options
Diffstat (limited to 'js/src/tests/test262/language/optional-chaining/optional-expression.js')
-rw-r--r-- | js/src/tests/test262/language/optional-chaining/optional-expression.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/optional-chaining/optional-expression.js b/js/src/tests/test262/language/optional-chaining/optional-expression.js new file mode 100644 index 0000000000..38cba72d21 --- /dev/null +++ b/js/src/tests/test262/language/optional-chaining/optional-expression.js @@ -0,0 +1,29 @@ +// 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 on recursive optional expression +info: | + Left-Hand-Side Expressions + OptionalExpression: + OptionalExpression OptionalChain +features: [optional-chaining] +---*/ + +const obj = { + a: { + b: 22 + } +}; + +function fn () { + return {}; +} + +// OptionalExpression (MemberExpression OptionalChain) OptionalChain +assert.sameValue(22, obj?.a?.b); +// OptionalExpression (CallExpression OptionalChain) OptionalChain +assert.sameValue(undefined, fn()?.a?.b); + +reportCompare(0, 0); |