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

Unified Diff: test/formatter_test.dart

Issue 1182953003: Eat some dogfood! (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 6 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: test/formatter_test.dart
diff --git a/test/formatter_test.dart b/test/formatter_test.dart
index aa70a54b4ad70c50cff6c4e1a5142b088a01d082..ff4e50d59a82c8b3b3872783a00c3dc78b0dcb94 100644
--- a/test/formatter_test.dart
+++ b/test/formatter_test.dart
@@ -21,7 +21,7 @@ void main() {
test("throws a FormatterException on failed parse", () {
var formatter = new DartFormatter();
expect(() => formatter.format('wat?!'),
- throwsA(new isInstanceOf<FormatterException>()));
+ throwsA(new isInstanceOf<FormatterException>()));
});
test("FormatterException describes parse errors", () {
@@ -43,8 +43,7 @@ void main() {
});
test("adds newline to unit", () {
- expect(new DartFormatter().format("var x = 1;"),
- equals("var x = 1;\n"));
+ expect(new DartFormatter().format("var x = 1;"), equals("var x = 1;\n"));
});
test("adds newline to unit after trailing comment", () {
@@ -53,8 +52,8 @@ void main() {
});
test("removes extra newlines", () {
- expect(new DartFormatter().format("var x = 1;\n\n\n"),
- equals("var x = 1;\n"));
+ expect(
+ new DartFormatter().format("var x = 1;\n\n\n"), equals("var x = 1;\n"));
});
test("does not add newline to statement", () {
@@ -64,10 +63,10 @@ void main() {
test('preserves initial indent', () {
var formatter = new DartFormatter(indent: 3);
- expect(formatter.formatStatement('if (foo) {bar;}'), equals(
- ' if (foo) {\n'
- ' bar;\n'
- ' }'));
+ expect(
+ formatter.formatStatement('if (foo) {bar;}'), equals(' if (foo) {\n'
+ ' bar;\n'
+ ' }'));
});
group('line endings', () {
@@ -87,18 +86,16 @@ void main() {
});
test('defaults to \\n if there are no newlines', () {
- expect(new DartFormatter().format("var i =1;"),
- equals("var i = 1;\n"));
+ expect(new DartFormatter().format("var i =1;"), equals("var i = 1;\n"));
});
test('handles Windows line endings in multiline strings', () {
- expect(new DartFormatter(lineEnding: "\r\n").formatStatement(
- ' """first\r\n'
- 'second\r\n'
- 'third""" ;'), equals(
- '"""first\r\n'
- 'second\r\n'
- 'third""";'));
+ expect(
+ new DartFormatter(lineEnding: "\r\n").formatStatement(' """first\r\n'
+ 'second\r\n'
+ 'third""" ;'), equals('"""first\r\n'
+ 'second\r\n'
+ 'third""";'));
});
});
}
@@ -155,14 +152,14 @@ void testDirectory(String name) {
test(description, () {
var isCompilationUnit = p.extension(entry.path) == ".unit";
- var inputCode = _extractSelection(input,
- isCompilationUnit: isCompilationUnit);
+ var inputCode =
+ _extractSelection(input, isCompilationUnit: isCompilationUnit);
var expected = _extractSelection(expectedOutput,
isCompilationUnit: isCompilationUnit);
- var formatter = new DartFormatter(
- pageWidth: pageWidth, indent: leadingIndent);
+ var formatter =
+ new DartFormatter(pageWidth: pageWidth, indent: leadingIndent);
var actual = formatter.formatSource(inputCode);

Powered by Google App Engine
This is Rietveld 408576698