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

Unified Diff: pkg/barback/test/asset_test.dart

Issue 22909059: Some more removals of dart:utf. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change ArgumentError to FormatException. 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
Index: pkg/barback/test/asset_test.dart
diff --git a/pkg/barback/test/asset_test.dart b/pkg/barback/test/asset_test.dart
index b26d4629cde8142236d4987b44c8dda43ddcdd0d..e40fc151172976636c87cee7bf9307e17ffeeaec 100644
--- a/pkg/barback/test/asset_test.dart
+++ b/pkg/barback/test/asset_test.dart
@@ -5,9 +5,8 @@
library barback.test.asset_test;
import 'dart:async';
-import 'dart:convert' show Encoding, UTF8, LATIN1;
+import 'dart:convert';
import 'dart:io';
-import 'dart:utf';
import 'package:barback/barback.dart';
import 'package:path/path.dart' as pathos;
@@ -24,7 +23,7 @@ main() {
Directory tempDir;
String binaryFilePath;
String textFilePath;
- String utf32FilePath;
+ String latin1FilePath;
setUp(() {
// Create a temp file we can use for assets.
@@ -35,8 +34,8 @@ main() {
textFilePath = pathos.join(tempDir.path, "file.txt");
new File(textFilePath).writeAsStringSync("çøñ†éℵ™");
- utf32FilePath = pathos.join(tempDir.path, "file.utf32");
- new File(utf32FilePath).writeAsBytesSync(encodeUtf32("çøñ†éℵ™"));
+ latin1FilePath = pathos.join(tempDir.path, "file.latin1");
+ new File(latin1FilePath).writeAsBytesSync(LATIN1.encode("blåbærgrød"));
});
tearDown(() {
@@ -77,7 +76,7 @@ main() {
test("gets the UTF-8-encoded string for a string asset", () {
var asset = new Asset.fromString(id, "çøñ†éℵ™");
expect(asset.read().toList(),
- completion(equals([encodeUtf8("çøñ†éℵ™")])));
+ completion(equals([UTF8.encode("çøñ†éℵ™")])));
});
test("gets the raw bytes for a byte asset", () {
@@ -95,20 +94,20 @@ main() {
test("gets the raw bytes for a text file", () {
var asset = new Asset.fromPath(id, textFilePath);
expect(asset.read().toList(),
- completion(equals([encodeUtf8("çøñ†éℵ™")])));
+ completion(equals([UTF8.encode("çøñ†éℵ™")])));
});
});
group("readAsString()", () {
group("byte asset", () {
test("defaults to UTF-8 if encoding is omitted", () {
- var asset = new Asset.fromBytes(id, encodeUtf8("çøñ†éℵ™"));
+ var asset = new Asset.fromBytes(id, UTF8.encode("çøñ†éℵ™"));
expect(asset.readAsString(),
completion(equals("çøñ†éℵ™")));
});
test("supports UTF-8", () {
- var asset = new Asset.fromBytes(id, encodeUtf8("çøñ†éℵ™"));
+ var asset = new Asset.fromBytes(id, UTF8.encode("çøñ†éℵ™"));
expect(asset.readAsString(encoding: UTF8),
completion(equals("çøñ†éℵ™")));
});

Powered by Google App Engine
This is Rietveld 408576698