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

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

Issue 26280005: Formatter code transform bit-flip support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | « pkg/analyzer_experimental/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_experimental/test/services/formatter_test.dart
===================================================================
--- pkg/analyzer_experimental/test/services/formatter_test.dart (revision 28325)
+++ pkg/analyzer_experimental/test/services/formatter_test.dart (working copy)
@@ -541,7 +541,7 @@
'var x = 1;\n'
);
});
-
+
test('CU - constructor', () {
expectCUFormatsTo(
'class A {\n'
@@ -623,16 +623,16 @@
'part of foo;\n'
);
});
-
+
test('CU (cons inits)', () {
expectCUFormatsTo('class X {\n'
' var x, y;\n'
' X() : x = 1, y = 2;\n'
- '}\n',
+ '}\n',
'class X {\n'
' var x, y;\n'
' X()\n'
- ' : x = 1,\n'
+ ' : x = 1,\n'
' y = 2;\n'
'}\n'
);
@@ -692,7 +692,7 @@
'var numbers = <int>[1, 2, (3 + 4)];'
);
});
-
+
test('stmt (lists)', () {
expectStmtFormatsTo(
'var l = [1,2,3,4];',
@@ -710,7 +710,7 @@
'var map = const {"foo": "bar", "fuz": null};',
'var map = const {"foo": "bar", "fuz": null};'
);
-
+
//Dangling ','
expectStmtFormatsTo(
'var map = {"foo": "bar",};',
@@ -778,26 +778,29 @@
'}'
);
});
-
+
test('Statement (if)', () {
- expectStmtFormatsTo('if (true) print("true!");',
+ expectStmtFormatsTo('if (true) print("true!");',
'if (true) print("true!");');
- expectStmtFormatsTo('if (true) { print("true!"); }',
+ expectStmtFormatsTo('if (true) { print("true!"); }',
'if (true) {\n'
' print("true!");\n'
'}');
- expectStmtFormatsTo('if (true) print("true!"); else print("false!");',
+ expectStmtFormatsTo('if (true) print("true!"); else print("false!");',
'if (true) {\n'
' print("true!");\n'
'} else {\n'
' print("false!");\n'
'}');
- });
+ expectStmtFormatsTo('if (true) print("true!"); else print("false!");',
Brian Wilkerson 2013/10/07 21:37:29 I expect you'll want to test the "transforms: true
pquitslund 2013/10/07 22:33:44 The expect above actually does that. I like your
+ 'if (true) print("true!"); else print("false!");',
+ transforms: false);
+ });
test('initialIndent', () {
var formatter = new CodeFormatter(
new FormatterOptions(initialIndentationLevel: 2));
- var formattedSource =
+ var formattedSource =
formatter.format(CodeKind.STATEMENT, 'var x;').source;
expect(formattedSource, startsWith(' '));
});
@@ -809,7 +812,7 @@
expectSelectedPostFormat('class X{int y;}', '}');
expectSelectedPostFormat('class X {}', ' {');
});
-
+
});
@@ -1025,8 +1028,9 @@
expect(() => new TokenStreamComparator(null, t1, t2).verifyEquals(),
throwsA(new isInstanceOf<FormatterException>()));
-expectCUFormatsTo(src, expected) =>
+expectCUFormatsTo(src, expected) =>
expect(formatCU(src).source, equals(expected));
-expectStmtFormatsTo(src, expected) =>
- expect(formatStatement(src), equals(expected));
+expectStmtFormatsTo(src, expected, {transforms: true}) =>
+ expect(formatStatement(src, options:
+ new FormatterOptions(codeTransforms: transforms)), equals(expected));
« no previous file with comments | « pkg/analyzer_experimental/lib/src/services/formatter_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698