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

Unified Diff: tests/compiler/dart2js/kernel/control_flow_test.dart

Issue 2301293002: kernel -> ssa: implement if-statements (Closed)
Patch Set: Created 4 years, 3 months 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
Index: tests/compiler/dart2js/kernel/control_flow_test.dart
diff --git a/tests/compiler/dart2js/kernel/control_flow_test.dart b/tests/compiler/dart2js/kernel/control_flow_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c6ffe844a49ce4a95e9cf14921c4a4b9c9726f64
--- /dev/null
+++ b/tests/compiler/dart2js/kernel/control_flow_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+import 'package:test/test.dart';
+
+import 'helper.dart' show check;
+
+main() {
+ group('compile control flow', () {
+ test('simple if statement', () {
+ String code = '''
+ main() {
+ if (true) {
Siggi Cherem (dart-lang) 2016/09/01 23:51:22 does this generate the condition (or are we elimin
Harry Terkelsen 2016/09/02 17:52:28 we can't compile logical operators yet, but I will
+ return 1;
+ } else {
+ return 2;
+ }
+ }''';
+ return check(code);
+ });
+ test('simple if statement no else', () {
+ String code = '''
+ main() {
+ if (true) {
+ return 1;
+ }
+ }''';
+ return check(code);
+ });
+ test('simple dead if statement', () {
+ String code = '''
+ main() {
+ if (false) {
+ return 1;
+ }
+ }''';
+ return check(code);
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698