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

Unified Diff: tests/lib/convert/line_splitter_test.dart

Issue 22860004: nits from cr 22070003 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: trailing whitespace 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
« no previous file with comments | « sdk/lib/convert/line_splitter.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/convert/line_splitter_test.dart
diff --git a/tests/lib/convert/line_splitter_test.dart b/tests/lib/convert/line_splitter_test.dart
index acdc633e480b85e51f0025d345a7939fe7b3615e..60a7c29f1600138e65b7be04eebfb2135fbaa52f 100644
--- a/tests/lib/convert/line_splitter_test.dart
+++ b/tests/lib/convert/line_splitter_test.dart
@@ -117,64 +117,22 @@ void testReadLine2() {
.transform(new Utf8Decoder())
.transform(new LineSplitter());
- var done = false;
+ var expectedLines = ['Line1', 'Line2','Line3', 'Line4',
+ '', '', '', '', '', '',
+ 'Line5', 'Line6'];
+
+ var index = 0;
- var stage = 0;
- var subStage = 0;
stream.listen((line) {
- if (stage == 0) {
- if (subStage == 0) {
- Expect.equals("Line1", line);
- subStage++;
- } else if (subStage == 1) {
- Expect.equals("Line2", line);
- subStage++;
- } else if (subStage == 2) {
- Expect.equals("Line3", line);
- subStage = 0;
- stage++;
- } else {
- Expect.fail("Stage 0 failed");
- }
- } else if (stage == 1) {
- if (subStage == 0) {
- Expect.equals("Line4", line);
- subStage = 0;
- stage++;
- } else {
- Expect.fail("Stage 1 failed");
- }
- } else if (stage == 2) {
- if (subStage < 4) {
- // Expect 5 empty lines. As long as the stream is not closed the
- // final \r cannot be interpreted as a end of line.
- Expect.equals("", line);
- subStage++;
- } else if (subStage == 4) {
- Expect.equals("", line);
- subStage = 0;
- stage++;
- } else {
- Expect.fail("Stage 2 failed");
- }
- } else if (stage == 3) {
- if (subStage == 0) {
- Expect.equals("", line);
- stage++;
- } else {
- Expect.fail("Stage 3 failed");
- }
- }
- }, onDone: () {
- Expect.equals(4, stage);
- Expect.equals(0, subStage);
- done = true;
- });
+ Expect.equals(expectedLines[index++], line);
+ });
// Note: codeUnits is fine. Text is ASCII.
controller.add("Line1\nLine2\r\nLine3\rLi".codeUnits);
controller.add("ne4\n".codeUnits);
controller.add("\n\n\r\n\r\n\r\r".codeUnits);
+ controller.add("Line5\r".codeUnits);
+ controller.add("\nLine6\n".codeUnits);
controller.close();
- Expect.isTrue(done, 'should be done here...');
+ Expect.equals(expectedLines.length, index);
}
« no previous file with comments | « sdk/lib/convert/line_splitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698