Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: tests/language/await_null_aware_test.dart

Issue 1417733007: VM: Fix bug with ??= expressions using await. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: added test, addressed comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/await_null_aware_test.dart
diff --git a/tests/language/enum_index_test.dart b/tests/language/await_null_aware_test.dart
similarity index 51%
copy from tests/language/enum_index_test.dart
copy to tests/language/await_null_aware_test.dart
index 21a8e0e94442b2da9e6057547fb2b0be4d08b441..483d9dd396a9cf1e7a8f8e55fce969a605733c58 100644
--- a/tests/language/enum_index_test.dart
+++ b/tests/language/await_null_aware_test.dart
@@ -2,31 +2,22 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// SharedOptions=--enable-enum
-
-// Test index access for enums.
-
-library enum_index_test;
+// Regression test for issue dartbug.com/24392
import 'package:expect/expect.dart';
+import 'dart:async';
-enum Enum {
- A,
- B,
+Future<int> f() async {
+ // Unreachable.
+ Expect.isTrue(false);
}
-class Class {
- var index;
-}
+main() async {
+ int x = 1;
+ x ??= await f();
+ Expect.equals(1, x);
-main() {
- test(null, new Class());
- test(0, Enum.A);
- test(1, Enum.B);
+ int y = 1;
+ y = y ?? await f();
+ Expect.equals(1, y);
}
-
-test(expected, object) {
- Expect.equals(expected, object.index);
-}
-
-
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698