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

Side by Side Diff: pkg/scheduled_test/lib/src/descriptor/file_descriptor.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library descriptor.file; 5 library descriptor.file;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 import 'dart:utf'; 10 import 'dart:utf';
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (orderedIterableEquals(contents, actualContents)) return; 56 if (orderedIterableEquals(contents, actualContents)) return;
57 if (isBinary) { 57 if (isBinary) {
58 // TODO(nweiz): show a hex dump here if the data is small enough. 58 // TODO(nweiz): show a hex dump here if the data is small enough.
59 throw "File '$name' didn't contain the expected binary data."; 59 throw "File '$name' didn't contain the expected binary data.";
60 } 60 }
61 throw _textMismatchMessage(textContents, 61 throw _textMismatchMessage(textContents,
62 new String.fromCharCodes(actualContents)); 62 new String.fromCharCodes(actualContents));
63 }); 63 });
64 } 64 }
65 65
66 Stream<List<int>> read() => new Future.immediate(contents).asStream(); 66 Stream<List<int>> read() => new Future.value(contents).asStream();
67 67
68 String describe() => name; 68 String describe() => name;
69 69
70 String _textMismatchMessage(String expected, String actual) { 70 String _textMismatchMessage(String expected, String actual) {
71 final expectedLines = expected.split('\n'); 71 final expectedLines = expected.split('\n');
72 final actualLines = actual.split('\n'); 72 final actualLines = actual.split('\n');
73 73
74 var results = []; 74 var results = [];
75 75
76 // Compare them line by line to see which ones match. 76 // Compare them line by line to see which ones match.
(...skipping 18 matching lines...) Expand all
95 } 95 }
96 } 96 }
97 } 97 }
98 98
99 return "File '$name' should contain:\n" 99 return "File '$name' should contain:\n"
100 "${prefixLines(expected)}\n" 100 "${prefixLines(expected)}\n"
101 "but actually contained:\n" 101 "but actually contained:\n"
102 "${results.join('\n')}"; 102 "${results.join('\n')}";
103 } 103 }
104 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698