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

Unified Diff: pkg/analyzer/test/services/formatter_test.dart

Issue 104993003: Formatter improvements (comments and empty bodies). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/analyzer/test/services/formatter_test.dart
===================================================================
--- pkg/analyzer/test/services/formatter_test.dart (revision 30859)
+++ pkg/analyzer/test/services/formatter_test.dart (working copy)
@@ -536,6 +536,40 @@
);
});
+ test('CU - comments (8)', () {
+ expectCUFormatsTo(
+ 'var x /* X */, y;\n',
+ 'var x /* X */, y;\n'
+ );
+ });
+
+ test('CU - comments (9)', () {
+ expectCUFormatsTo(
+ 'main() {\n'
+ ' foo(1 /* bang */, 2);\n'
+ '}\n'
+ 'foo(x, y) => null;\n',
+ 'main() {\n'
+ ' foo(1 /* bang */, 2);\n'
+ '}\n'
+ 'foo(x, y) => null;\n'
+ );
+ });
+
+ test('CU - comments (10)', () {
Brian Wilkerson 2013/12/04 19:52:50 If there isn't already, it might be good to add a
pquitslund 2013/12/04 21:09:10 Good call. I've got one of those in my list tests
+ expectCUFormatsTo(
+ 'var l = [1 /* bang */, 2];\n',
+ 'var l = [1 /* bang */, 2];\n'
+ );
+ });
+
+ test('CU - comments (11)', () {
+ expectCUFormatsTo(
+ 'var m = {1: 2 /* bang */, 3: 4};\n',
+ 'var m = {1: 2 /* bang */, 3: 4};\n'
+ );
+ });
+
test('CU - EOF nl', () {
expectCUFormatsTo(
'var x = 1;',
@@ -711,6 +745,20 @@
);
});
+ test('stmt (empty while body)', () {
+ expectStmtFormatsTo(
+ 'while (true);',
+ 'while (true);'
+ );
+ });
+
+ test('stmt (empty for body)', () {
+ expectStmtFormatsTo(
+ 'for ( ; ; );',
+ 'for ( ; ; );'
+ );
+ });
+
test('stmt (cascades)', () {
expectStmtFormatsTo(
'"foo"\n'

Powered by Google App Engine
This is Rietveld 408576698