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

Side by Side Diff: tests/standalone/io/stream_pipe_test.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 9 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 library ServerTest; 9 library ServerTest;
10 10
(...skipping 16 matching lines...) Expand all
27 var length1 = file1.lengthSync(); 27 var length1 = file1.lengthSync();
28 var length2 = file2.lengthSync(); 28 var length2 = file2.lengthSync();
29 if (file1Offset == 0 && file2Offset == 0 && count == null) { 29 if (file1Offset == 0 && file2Offset == 0 && count == null) {
30 if (length1 != length2) { 30 if (length1 != length2) {
31 file1.closeSync(); 31 file1.closeSync();
32 file2.closeSync(); 32 file2.closeSync();
33 return false; 33 return false;
34 } 34 }
35 } 35 }
36 if (count == null) count = length1; 36 if (count == null) count = length1;
37 var data1 = new List<int>.fixedLength(count); 37 var data1 = new List<int>(count);
38 var data2 = new List<int>.fixedLength(count); 38 var data2 = new List<int>(count);
39 if (file1Offset != 0) file1.setPositionSync(file1Offset); 39 if (file1Offset != 0) file1.setPositionSync(file1Offset);
40 if (file2Offset != 0) file2.setPositionSync(file2Offset); 40 if (file2Offset != 0) file2.setPositionSync(file2Offset);
41 var read1 = file1.readListSync(data1, 0, count); 41 var read1 = file1.readListSync(data1, 0, count);
42 Expect.equals(count, read1); 42 Expect.equals(count, read1);
43 var read2 = file2.readListSync(data2, 0, count); 43 var read2 = file2.readListSync(data2, 0, count);
44 Expect.equals(count, read2); 44 Expect.equals(count, read2);
45 for (var i = 0; i < count; i++) { 45 for (var i = 0; i < count; i++) {
46 if (data1[i] != data2[i]) { 46 if (data1[i] != data2[i]) {
47 file1.closeSync(); 47 file1.closeSync();
48 file2.closeSync(); 48 file2.closeSync();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 output.done.then((_) { 105 output.done.then((_) {
106 var src = srcFile.openSync(); 106 var src = srcFile.openSync();
107 var dst = dstFile.openSync(); 107 var dst = dstFile.openSync();
108 var srcLength = src.lengthSync(); 108 var srcLength = src.lengthSync();
109 var dstLength = dst.lengthSync(); 109 var dstLength = dst.lengthSync();
110 Expect.equals(srcLength + 1, dstLength); 110 Expect.equals(srcLength + 1, dstLength);
111 Expect.isTrue(compareFileContent(srcFileName, 111 Expect.isTrue(compareFileContent(srcFileName,
112 dstFileName, 112 dstFileName,
113 count: srcLength)); 113 count: srcLength));
114 dst.setPositionSync(srcLength); 114 dst.setPositionSync(srcLength);
115 var data = new List<int>.fixedLength(1); 115 var data = new List<int>(1);
116 var read2 = dst.readListSync(data, 0, 1); 116 var read2 = dst.readListSync(data, 0, 1);
117 Expect.equals(32, data[0]); 117 Expect.equals(32, data[0]);
118 src.closeSync(); 118 src.closeSync();
119 dst.closeSync(); 119 dst.closeSync();
120 dstFile.deleteSync(); 120 dstFile.deleteSync();
121 tempDir.deleteSync(); 121 tempDir.deleteSync();
122 donePort.toSendPort().send(null); 122 donePort.toSendPort().send(null);
123 }); 123 });
124 }); 124 });
125 } 125 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 }); 168 });
169 }); 169 });
170 } 170 }
171 171
172 172
173 main() { 173 main() {
174 testFileToFilePipe1(); 174 testFileToFilePipe1();
175 testFileToFilePipe2(); 175 testFileToFilePipe2();
176 testFileToFilePipe3(); 176 testFileToFilePipe3();
177 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698