| 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..05ece1fe810ee1df9749889da82c49fac2306827 100644
|
| --- a/pkg/barback/test/asset_test.dart
|
| +++ b/pkg/barback/test/asset_test.dart
|
| @@ -73,6 +73,14 @@ main() {
|
| });
|
| });
|
|
|
| + group("Asset.fromStream", () {
|
| + test("returns an asset with the given ID", () {
|
| + var asset = new Asset.fromStream(id,
|
| + new Stream.fromFuture(new Future.value([104, 101, 108, 108, 111])));
|
| + expect(asset.id, equals(id));
|
| + });
|
| + });
|
| +
|
| group("read()", () {
|
| test("gets the UTF-8-encoded string for a string asset", () {
|
| var asset = new Asset.fromString(id, "çøñ†éℵ™");
|
| @@ -97,6 +105,13 @@ main() {
|
| expect(asset.read().toList(),
|
| completion(equals([encodeUtf8("çøñ†éℵ™")])));
|
| });
|
| +
|
| + test("gets the raw bytes for a stream", () {
|
| + var asset = new Asset.fromStream(id,
|
| + new Stream.fromFuture(new Future.value(encodeUtf8("çøñ†éℵ™"))));
|
| + expect(asset.read().toList(),
|
| + completion(equals([encodeUtf8("çøñ†éℵ™")])));
|
| + });
|
| });
|
|
|
| group("readAsString()", () {
|
| @@ -137,6 +152,24 @@ main() {
|
| completion(equals("çøñ†éℵ™")));
|
| });
|
| });
|
| +
|
| + group("stream asset", () {
|
| + test("defaults to UTF-8 if encoding is omitted", () {
|
| + var asset = new Asset.fromStream(id,
|
| + new Stream.fromFuture(new Future.value(encodeUtf8("çøñ†éℵ™"))));
|
| + expect(asset.readAsString(),
|
| + completion(equals("çøñ†éℵ™")));
|
| + });
|
| +
|
| + test("supports UTF-8", () {
|
| + var asset = new Asset.fromStream(id,
|
| + new Stream.fromFuture(new Future.value(encodeUtf8("çøñ†éℵ™"))));
|
| + expect(asset.readAsString(encoding: UTF8),
|
| + completion(equals("çøñ†éℵ™")));
|
| + });
|
| +
|
| + // TODO(nweiz): Test other encodings once #6284 is fixed.
|
| + });
|
| });
|
|
|
| group("toString()", () {
|
|
|