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

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

Issue 23526033: Fix file_test after changing exception throw from readAsStringSync in File. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 var text = new File(name).readAsStringSync(); 1008 var text = new File(name).readAsStringSync();
1009 Expect.isTrue(text.endsWith("42 bytes.")); 1009 Expect.isTrue(text.endsWith("42 bytes."));
1010 Expect.equals(42, text.length); 1010 Expect.equals(42, text.length);
1011 name = getDataFilename("tests/standalone/io/read_as_text.dat"); 1011 name = getDataFilename("tests/standalone/io/read_as_text.dat");
1012 text = new File(name).readAsStringSync(); 1012 text = new File(name).readAsStringSync();
1013 Expect.equals(6, text.length); 1013 Expect.equals(6, text.length);
1014 var expected = [955, 120, 46, 32, 120, 10]; 1014 var expected = [955, 120, 46, 32, 120, 10];
1015 Expect.listEquals(expected, text.codeUnits); 1015 Expect.listEquals(expected, text.codeUnits);
1016 // First character is not ASCII. The default ASCII decoder will throw. 1016 // First character is not ASCII. The default ASCII decoder will throw.
1017 Expect.throws(() => new File(name).readAsStringSync(encoding: ASCII), 1017 Expect.throws(() => new File(name).readAsStringSync(encoding: ASCII),
1018 (e) => e is FormatException); 1018 (e) => e is FileException);
1019 // We can use an ASCII decoder that inserts the replacement character. 1019 // We can use an ASCII decoder that inserts the replacement character.
1020 var lenientAscii = const AsciiCodec(allowInvalid: true); 1020 var lenientAscii = const AsciiCodec(allowInvalid: true);
1021 text = new File(name).readAsStringSync(encoding: lenientAscii); 1021 text = new File(name).readAsStringSync(encoding: lenientAscii);
1022 // Default replacement character is the Unicode replacement character. 1022 // Default replacement character is the Unicode replacement character.
1023 expected = [UNICODE_REPLACEMENT_CHARACTER_RUNE, 1023 expected = [UNICODE_REPLACEMENT_CHARACTER_RUNE,
1024 UNICODE_REPLACEMENT_CHARACTER_RUNE, 1024 UNICODE_REPLACEMENT_CHARACTER_RUNE,
1025 120, 46, 32, 120, 10]; 1025 120, 46, 32, 120, 10];
1026 Expect.listEquals(expected, text.codeUnits); 1026 Expect.listEquals(expected, text.codeUnits);
1027 text = new File(name).readAsStringSync(encoding: LATIN1); 1027 text = new File(name).readAsStringSync(encoding: LATIN1);
1028 expected = [206, 187, 120, 46, 32, 120, 10]; 1028 expected = [206, 187, 120, 46, 32, 120, 10];
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 testRenameSync(); 1312 testRenameSync();
1313 testLastModified(); 1313 testLastModified();
1314 asyncEnd(); 1314 asyncEnd();
1315 }); 1315 });
1316 } 1316 }
1317 } 1317 }
1318 1318
1319 main() { 1319 main() {
1320 FileTest.testMain(); 1320 FileTest.testMain();
1321 } 1321 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698