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

Unified Diff: pkg/analyzer2dart/test/end2end_test.dart

Issue 662363002: Support if-statements in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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: pkg/analyzer2dart/test/end2end_test.dart
diff --git a/pkg/analyzer2dart/test/end2end_test.dart b/pkg/analyzer2dart/test/end2end_test.dart
index c5f8ecf25253bc69e2ca133f7892814bd6120cb4..6d2592997606a32a53a3491a6be40be4b8be4b63 100644
--- a/pkg/analyzer2dart/test/end2end_test.dart
+++ b/pkg/analyzer2dart/test/end2end_test.dart
@@ -435,6 +435,57 @@ main(a) {
}
''');
});
+
+ test('If statement', () {
+ checkResult('''
+main(a) {
+ if (a) {
+ print(0);
+ }
+}
+''', '''
+main(a) {
+ if (a) {
+ print(0);
+ }
+}
+''');
+
+ checkResult('''
+main(a) {
+ if (a) {
+ print(0);
+ } else {
+ print(1);
+ }
+}
+''', '''
+main(a) {
+ a ? print(0) : print(1);
+}
+''');
+
+ checkResult('''
+main(a) {
+ if (a) {
+ print(0);
+ } else {
+ print(1);
+ print(2);
+ }
+}
+''', '''
+main(a) {
+ if (a) {
+ print(0);
+ } else {
+ print(1);
+ print(2);
+ }
+}
+''');
+
+ });
}
checkResult(String input, [String expectedOutput]) {

Powered by Google App Engine
This is Rietveld 408576698