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

Unified Diff: tests/standalone/io/file_test.dart

Issue 11412033: Rename File.readAsText to File.readAsString. There is no Text type in Dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « tests/standalone/io/file_non_ascii_test.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_test.dart
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 2f210f42e91db84d852c1df17ae93ad7cbedc100..2cfd32d7916e55ddb9c2cca54f447304e2f03710 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -1037,24 +1037,24 @@ class FileTest {
});
var name = getFilename("tests/vm/data/fixed_length_file");
var f = new File(name);
- f.readAsText(Encoding.UTF_8).then((text) {
+ f.readAsString(Encoding.UTF_8).then((text) {
Expect.isTrue(text.endsWith("42 bytes."));
Expect.equals(42, text.length);
var name = getDataFilename("tests/standalone/io/read_as_text.dat");
var f = new File(name);
- f.readAsText(Encoding.UTF_8).then((text) {
+ f.readAsString(Encoding.UTF_8).then((text) {
Expect.equals(6, text.length);
var expected = [955, 120, 46, 32, 120, 10];
Expect.listEquals(expected, text.charCodes);
- f.readAsText(Encoding.ISO_8859_1).then((text) {
+ f.readAsString(Encoding.ISO_8859_1).then((text) {
Expect.equals(7, text.length);
var expected = [206, 187, 120, 46, 32, 120, 10];
Expect.listEquals(expected, text.charCodes);
- var readAsTextFuture = f.readAsText(Encoding.ASCII);
- readAsTextFuture.then((text) {
+ var readAsStringFuture = f.readAsString(Encoding.ASCII);
+ readAsStringFuture.then((text) {
Expect.fail("Non-ascii char should cause error");
});
- readAsTextFuture.handleException((e) {
+ readAsStringFuture.handleException((e) {
port.toSendPort().send(1);
return true;
});
@@ -1071,7 +1071,7 @@ class FileTest {
});
var name = getFilename("tests/vm/data/empty_file");
var f = new File(name);
- f.readAsText(Encoding.UTF_8).then((text) {
+ f.readAsString(Encoding.UTF_8).then((text) {
port.toSendPort().send(text.length);
return true;
});
@@ -1079,16 +1079,16 @@ class FileTest {
static void testReadAsTextSync() {
var name = getFilename("tests/vm/data/fixed_length_file");
- var text = new File(name).readAsTextSync();
+ var text = new File(name).readAsStringSync();
Expect.isTrue(text.endsWith("42 bytes."));
Expect.equals(42, text.length);
name = getDataFilename("tests/standalone/io/read_as_text.dat");
- text = new File(name).readAsTextSync();
+ text = new File(name).readAsStringSync();
Expect.equals(6, text.length);
var expected = [955, 120, 46, 32, 120, 10];
Expect.listEquals(expected, text.charCodes);
- Expect.throws(() { new File(name).readAsTextSync(Encoding.ASCII); });
- text = new File(name).readAsTextSync(Encoding.ISO_8859_1);
+ Expect.throws(() { new File(name).readAsStringSync(Encoding.ASCII); });
+ text = new File(name).readAsStringSync(Encoding.ISO_8859_1);
expected = [206, 187, 120, 46, 32, 120, 10];
Expect.equals(7, text.length);
Expect.listEquals(expected, text.charCodes);
@@ -1096,7 +1096,7 @@ class FileTest {
static void testReadAsTextSyncEmptyFile() {
var name = getFilename("tests/vm/data/empty_file");
- var text = new File(name).readAsTextSync();
+ var text = new File(name).readAsStringSync();
Expect.equals(0, text.length);
}
@@ -1137,14 +1137,14 @@ class FileTest {
});
var f = new File('.');
Expect.throws(f.readAsBytesSync, (e) => e is FileIOException);
- Expect.throws(f.readAsTextSync, (e) => e is FileIOException);
+ Expect.throws(f.readAsStringSync, (e) => e is FileIOException);
Expect.throws(f.readAsLinesSync, (e) => e is FileIOException);
var readAsBytesFuture = f.readAsBytes();
readAsBytesFuture.then((bytes) => Expect.fail("no bytes expected"));
readAsBytesFuture.handleException((e) {
- var readAsTextFuture = f.readAsText(Encoding.UTF_8);
- readAsTextFuture.then((text) => Expect.fail("no text expected"));
- readAsTextFuture.handleException((e) {
+ var readAsStringFuture = f.readAsString(Encoding.UTF_8);
+ readAsStringFuture.then((text) => Expect.fail("no text expected"));
+ readAsStringFuture.handleException((e) {
var readAsLinesFuture = f.readAsLines(Encoding.UTF_8);
readAsLinesFuture.then((lines) => Expect.fail("no lines expected"));
readAsLinesFuture.handleException((e) {
@@ -1232,7 +1232,7 @@ class FileTest {
openedFile.length().then((l) {
Expect.equals(4, l);
openedFile.close().then((_) {
- file.readAsText().then((readBack) {
+ file.readAsString().then((readBack) {
Expect.stringEquals(readBack, '$string$string');
file.delete().then((_) {
file.exists().then((e) {
@@ -1265,7 +1265,7 @@ class FileTest {
openedFile.writeStringSync(string);
Expect.equals(4, openedFile.lengthSync());
openedFile.closeSync();
- var readBack = file.readAsTextSync();
+ var readBack = file.readAsStringSync();
Expect.stringEquals(readBack, '$string$string');
file.deleteSync();
Expect.isFalse(file.existsSync());
diff --git "a/tests/standalone/io/\303\246\303\270\303\245.dart" "b/tests/standalone/io/\303\246\303\270\303\245.dart"
index abf731c1678f469eecbf8a4130aea6348aba9dab..d03e720dc882ae94fcec68faef1e42cd58348419 100644
--- "a/tests/standalone/io/\303\246\303\270\303\245.dart"
+++ "b/tests/standalone/io/\303\246\303\270\303\245.dart"
@@ -5,5 +5,5 @@
import 'dart:io';
main() {
- Expect.equals('æøå', new File('æøå.dat').readAsTextSync());
+ Expect.equals('æøå', new File('æøå.dat').readAsStringSync());
}
« no previous file with comments | « tests/standalone/io/file_non_ascii_test.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698