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

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

Issue 23301021: Formatter checkpoint (String literal elimination). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/analyzer_experimental/test/services/formatter_test.dart
===================================================================
--- pkg/analyzer_experimental/test/services/formatter_test.dart (revision 26603)
+++ pkg/analyzer_experimental/test/services/formatter_test.dart (working copy)
@@ -117,6 +117,27 @@
'}\n'
);
});
+
+ test('CU - method invocations', () {
+ expectCUFormatsTo(
+ 'class A {\n'
+ ' foo() {\n'
+ ' bar();\n'
+ ' for (int i = 0; i < 42; i++) {\n'
+ ' baz();\n'
+ ' }\n'
+ ' }\n'
+ '}\n',
+ 'class A {\n'
+ ' foo() {\n'
+ ' bar();\n'
+ ' for (int i = 0; i < 42; i++) {\n'
+ ' baz();\n'
+ ' }\n'
+ ' }\n'
+ '}\n'
+ );
+ });
test('CU w/class decl comment', () {
expectCUFormatsTo(
@@ -255,7 +276,68 @@
'}\n'
);
});
+
+ test('CU - constructor', () {
+ expectCUFormatsTo(
+ 'class A {\n'
+ ' const _a;\n'
+ ' A();\n'
+ ' int a() => _a;\n'
+ '}\n',
+ 'class A {\n'
+ ' const _a;\n'
+ ' A();\n'
+ ' int a() => _a;\n'
+ '}\n'
+ );
+ });
+ test('CU - method decl w/ named params', () {
+ expectCUFormatsTo(
+ 'class A {\n'
+ ' int a(var x, {optional: null}) => null;\n'
+ '}\n',
+ 'class A {\n'
+ ' int a(var x, {optional: null}) => null;\n'
+ '}\n'
+ );
+ });
+
+ test('CU - method decl w/ optional params', () {
+ expectCUFormatsTo(
+ 'class A {\n'
+ ' int a(var x, [optional = null]) => null;\n'
+ '}\n',
+ 'class A {\n'
+ ' int a(var x, [optional = null]) => null;\n'
+ '}\n'
+ );
+ });
+
+ test('CU - factory constructor redirects', () {
+ expectCUFormatsTo(
+ 'class A {\n'
+ ' const factory A() = B;\n'
+ '}\n',
+ 'class A {\n'
+ ' const factory A() = B;\n'
+ '}\n'
+ );
+ });
+
+ test('CU - constructor initializers', () {
+ expectCUFormatsTo(
+ 'class A {\n'
+ ' int _a;\n'
+ ' A(a) : _a = a;\n'
+ '}\n',
+ 'class A {\n'
+ ' int _a;\n'
+ ' A(a) : _a = a;\n'
+ '}\n'
+ );
+ });
+
test('stmt', () {
expectStmtFormatsTo(
'if (true){\n'

Powered by Google App Engine
This is Rietveld 408576698