summaryrefslogtreecommitdiff
path: root/test/language/expressions/optional-chaining/iteration-statement-while.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/language/expressions/optional-chaining/iteration-statement-while.js')
-rw-r--r--test/language/expressions/optional-chaining/iteration-statement-while.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/language/expressions/optional-chaining/iteration-statement-while.js b/test/language/expressions/optional-chaining/iteration-statement-while.js
new file mode 100644
index 000000000..80fffa929
--- /dev/null
+++ b/test/language/expressions/optional-chaining/iteration-statement-while.js
@@ -0,0 +1,18 @@
+// Copyright 2019 Google, LLC. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: prod-OptionalExpression
+description: >
+ optional chain in test portion of while statement
+info: |
+ IterationStatement
+ while (Expression) Statement
+features: [optional-chaining]
+---*/
+let count = 0;
+const obj = {a: true};
+while (obj?.a) {
+ count++;
+ break;
+}
+assert.sameValue(1, count);