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

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

Issue 132983008: Line pre-chunking. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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/lib/src/services/writer.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 31927)
+++ pkg/analyzer/test/services/formatter_test.dart (working copy)
@@ -1237,6 +1237,11 @@
expect(chunks.map((chunk) => chunk.toString()), orderedEquals(texts));
}
+ expectTokensEqual(List<LineToken> tokens, List<String> texts) {
+ expect(tokens.map((token) => token.toString()), orderedEquals(texts));
+ }
+
+
final SP_1 = new SpaceToken(1, breakWeight: 1);
// 'foo|1|bar|1|baz|1|foo|1|bar|1|baz'
@@ -1310,6 +1315,24 @@
expect(isWhitespace('\r'), true);
});
+ test('preprocess - 1', () {
+ var tokens = line(['f', 'o', 'o', SP_1, 'b', 'a', 'r']).tokens;
+ var processed = SimpleLineBreaker.preprocess(tokens);
+ expectTokensEqual(processed, ['foo', ' ', 'bar']);
+ });
+
+ test('preprocess - 2', () {
+ var tokens = line(['f', 'o', 'o', SP_1, SP_1, 'b', 'a', 'r']).tokens;
+ var processed = SimpleLineBreaker.preprocess(tokens);
+ expectTokensEqual(processed, ['foo', ' ', ' ', 'bar']);
+ });
+
+ test('preprocess - 3', () {
+ var tokens = line(['f', 'o', 'o', SP_1, 'b', 'a', 'r', SP_1]).tokens;
+ var processed = SimpleLineBreaker.preprocess(tokens);
+ expectTokensEqual(processed, ['foo', ' ', 'bar', ' ']);
+ });
+
});
/// Helper method tests
« no previous file with comments | « pkg/analyzer/lib/src/services/writer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698