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

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

Issue 109423004: Formatter line continuation awareness hooks. (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
« no previous file with comments | « pkg/analyzer/lib/src/services/formatter_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/services/formatter_test.dart
===================================================================
--- pkg/analyzer/test/services/formatter_test.dart (revision 31200)
+++ pkg/analyzer/test/services/formatter_test.dart (working copy)
@@ -914,6 +914,123 @@
transforms: false);
});
+// test('line continuations - 1', () {
+// expectStmtFormatsTo(
+// 'if (x &&\n'
+// ' y) {\n'
+// ' print("yes!");\n'
+// '}',
+// 'if (x &&\n'
+// ' y) {\n'
+// ' print("yes!");\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'var x =\n'
+// ' 1234567890;',
+// 'var x =\n'
+// ' 1234567890;'
+// );
+// expectStmtFormatsTo(
+// 'foo() {\n'
+// ' var x = 0;\n'
+// ' x =\n'
+// ' 1234567890;\n'
+// '}',
+// 'foo() {\n'
+// ' var x = 0;\n'
+// ' x =\n'
+// ' 1234567890;\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'foo() {\n'
+// ' while (true &&\n'
+// ' true) {\n'
+// ' print("!");\n'
+// ' }\n'
+// '}',
+// 'foo() {\n'
+// ' while (true &&\n'
+// ' true) {\n'
+// ' print("!");\n'
+// ' }\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'foo() {\n'
+// ' do {\n'
+// ' print("!");\n'
+// ' } while (true &&\n'
+// ' true);\n'
+// '}',
+// 'foo() {\n'
+// ' do {\n'
+// ' print("!");\n'
+// ' } while (true &&\n'
+// ' true);\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'int foo() {\n'
+// ' return\n'
+// ' foo();\n'
+// '}',
+// 'int foo() {\n'
+// ' return\n'
+// ' foo();\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'int foo() {\n'
+// ' return\n'
+// ' 13;\n'
+// '}',
+// 'int foo() {\n'
+// ' return\n'
+// ' 13;\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'foo(fn()) {\n'
+// ' return foo(() {\n'
+// ' return 1;\n'
+// '});\n'
+// '}',
+// 'foo(fn()) {\n'
+// ' return foo(() {\n'
+// ' return 1;\n'
+// '});\n'
+// '}'
+// );
+// expectStmtFormatsTo(
+// 'true ? foo() :\n'
+// ' bar();',
+// 'true ? foo() :\n'
+// ' bar();'
+// );
+// expectCUFormatsTo(
+// 'import "dart:core" as\n'
+// ' core;\n',
+// 'import "dart:core" as\n'
+// ' core;\n'
+// );
+// expectCUFormatsTo(
+// 'export "package:foo/foo.dart" show\n'
+// ' Foo;\n',
+// 'export "package:foo/foo.dart" show\n'
+// ' Foo;\n'
+// );
+// expectCUFormatsTo(
+// 'class Foo extends Bar implements\n'
+// ' Baz {\n'
+// '}\n',
+// 'class Foo extends Bar implements\n'
+// ' Baz {\n'
+// '}\n'
+// );
+// });
+
test('initialIndent', () {
var formatter = new CodeFormatter(
new FormatterOptions(initialIndentationLevel: 2));
« no previous file with comments | « pkg/analyzer/lib/src/services/formatter_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698