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

Unified Diff: tests/compiler/dart2js/js_parser_statements_test.dart

Issue 954493002: Revert "Avoid printing braces for one-statement blocks in js-printer." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « tests/compiler/dart2js/async_await_js_transform_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/js_parser_statements_test.dart
diff --git a/tests/compiler/dart2js/js_parser_statements_test.dart b/tests/compiler/dart2js/js_parser_statements_test.dart
index 195c7be3e6be93acf17f7082c535c29b2927721e..e9bc2e1b6e37b2794c90affc148b52b6a4334c46 100644
--- a/tests/compiler/dart2js/js_parser_statements_test.dart
+++ b/tests/compiler/dart2js/js_parser_statements_test.dart
@@ -133,7 +133,6 @@ void main() {
{'a': false, 'b': block12},
'{\n 1;\n 2;\n}'),
-
testStatement('while (#) #', [eOne, block12], 'while (1) {\n 1;\n 2;\n}'),
testStatement('while (#) #;', [eTrue, block12],
'while (true) {\n 1;\n 2;\n}'),
@@ -144,9 +143,9 @@ void main() {
testStatement('while (#) #;', ['a', stm],
'while (a)\n foo();'),
- testStatement(
- 'do { {print(1);} do while(true); while (false) } while ( true )', [],
- '''
+ testStatement(
+ 'do { {print(1);} do while(true); while (false) } while ( true )', [],
+ '''
do {
print(1);
do
@@ -324,7 +323,7 @@ switch (true) {
'};'),
testStatement('label: while (a) { label2: break label;}', [],
- 'label:\n while (a)\n label2:\n break label;\n '),
+ 'label:\n while (a) {\n label2:\n break label;\n }'),
testStatement('var # = 3', ['x'], 'var x = 3;'),
@@ -346,52 +345,5 @@ switch (true) {
testStatement('try {} catch (#a) {}',
{"a": new jsAst.VariableDeclaration('x')},
'try {\n} catch (x) {\n}'),
-
- // Test that braces around a single-statement block are removed by printer.
- testStatement('while (a) {foo()}', [],
- 'while (a)\n foo();'),
- testStatement('if (a) {foo();}', [],
- 'if (a)\n foo();'),
- testStatement('if (a) {foo();} else {foo2();}', [],
- 'if (a)\n foo();\nelse\n foo2();'),
- testStatement('if (a) foo(); else {foo2();}', [],
- 'if (a)\n foo();\nelse\n foo2();'),
- testStatement('do {foo();} while(a);', [],
- 'do\n foo();\nwhile (a);'),
- testStatement('label: {foo();}', [],
- 'label:\n foo();'),
- testStatement('for (var key in a) {foo();}', [],
- 'for (var key in a)\n foo();'),
- // Test dangling else:
- testStatement('if (a) {if (b) {foo1();}} else {foo2();}', [], """
-if (a) {
- if (b)
- foo1();
-} else
- foo2();"""),
- testStatement('if (a) {if (b) {foo1();} else {foo2();}}', [], """
-if (a)
- if (b)
- foo1();
- else
- foo2();
-"""),
- testStatement('if (a) {if (b) {foo1();} else {foo2();}} else {foo3();}',
- [], """
-if (a)
- if (b)
- foo1();
- else
- foo2();
-else
- foo3();"""),
- testStatement('if (a) {while (true) if (b) {foo1();}} else {foo2();}',
- [], """
-if (a) {
- while (true)
- if (b)
- foo1();
-} else
- foo2();"""),
]));
}
« no previous file with comments | « tests/compiler/dart2js/async_await_js_transform_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698