Index: packages/barback/test/asset_test.dart |
diff --git a/packages/barback/test/asset_test.dart b/packages/barback/test/asset_test.dart |
index 7936c71fc194e1a59467b2bde4399fb07e0032cf..ce58229891be51924e44601b7b0bf2b774a2a258 100644 |
--- a/packages/barback/test/asset_test.dart |
+++ b/packages/barback/test/asset_test.dart |
@@ -85,33 +85,31 @@ main() { |
group("read()", () { |
test("gets the UTF-8-encoded string for a string asset", () { |
var asset = new Asset.fromString(id, "çøñ†éℵ™"); |
- expect(asset.read().toList(), |
- completion(equals([UTF8.encode("çøñ†éℵ™")]))); |
+ expect( |
+ asset.read().toList(), completion(equals([UTF8.encode("çøñ†éℵ™")]))); |
}); |
test("gets the raw bytes for a byte asset", () { |
var asset = new Asset.fromBytes(id, binaryContents); |
- expect(asset.read().toList(), |
- completion(equals([binaryContents]))); |
+ expect(asset.read().toList(), completion(equals([binaryContents]))); |
}); |
test("gets the raw bytes for a binary file", () { |
var asset = new Asset.fromPath(id, binaryFilePath); |
- expect(asset.read().toList(), |
- completion(equals([binaryContents]))); |
+ expect(asset.read().toList(), completion(equals([binaryContents]))); |
}); |
test("gets the raw bytes for a text file", () { |
var asset = new Asset.fromPath(id, textFilePath); |
- expect(asset.read().toList(), |
- completion(equals([UTF8.encode("çøñ†éℵ™")]))); |
+ expect( |
+ asset.read().toList(), completion(equals([UTF8.encode("çøñ†éℵ™")]))); |
}); |
test("gets the raw bytes for a stream", () { |
- var asset = new Asset.fromStream(id, |
- new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™")))); |
- expect(asset.read().toList(), |
- completion(equals([UTF8.encode("çøñ†éℵ™")]))); |
+ var asset = new Asset.fromStream( |
+ id, new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™")))); |
+ expect( |
+ asset.read().toList(), completion(equals([UTF8.encode("çøñ†éℵ™")]))); |
}); |
}); |
@@ -119,14 +117,13 @@ main() { |
group("byte asset", () { |
test("defaults to UTF-8 if encoding is omitted", () { |
var asset = new Asset.fromBytes(id, UTF8.encode("çøñ†éℵ™")); |
- expect(asset.readAsString(), |
- completion(equals("çøñ†éℵ™"))); |
+ expect(asset.readAsString(), completion(equals("çøñ†éℵ™"))); |
}); |
test("supports UTF-8", () { |
var asset = new Asset.fromBytes(id, UTF8.encode("çøñ†éℵ™")); |
- expect(asset.readAsString(encoding: UTF8), |
- completion(equals("çøñ†éℵ™"))); |
+ expect( |
+ asset.readAsString(encoding: UTF8), completion(equals("çøñ†éℵ™"))); |
}); |
// TODO(rnystrom): Test other encodings once #6284 is fixed. |
@@ -135,8 +132,7 @@ main() { |
group("string asset", () { |
test("gets the string", () { |
var asset = new Asset.fromString(id, "contents"); |
- expect(asset.readAsString(), |
- completion(equals("contents"))); |
+ expect(asset.readAsString(), completion(equals("contents"))); |
}); |
test("ignores the encoding", () { |
@@ -149,8 +145,7 @@ main() { |
group("file asset", () { |
test("defaults to UTF-8 if encoding is omitted", () { |
var asset = new Asset.fromPath(id, textFilePath); |
- expect(asset.readAsString(), |
- completion(equals("çøñ†éℵ™"))); |
+ expect(asset.readAsString(), completion(equals("çøñ†éℵ™"))); |
}); |
}); |
@@ -158,15 +153,14 @@ main() { |
test("defaults to UTF-8 if encoding is omitted", () { |
var asset = new Asset.fromStream(id, |
new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™")))); |
- expect(asset.readAsString(), |
- completion(equals("çøñ†éℵ™"))); |
+ expect(asset.readAsString(), completion(equals("çøñ†éℵ™"))); |
}); |
test("supports UTF-8", () { |
var asset = new Asset.fromStream(id, |
new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™")))); |
- expect(asset.readAsString(encoding: UTF8), |
- completion(equals("çøñ†éℵ™"))); |
+ expect( |
+ asset.readAsString(encoding: UTF8), completion(equals("çøñ†éℵ™"))); |
}); |
test("supports ISO-8859-1", () { |
@@ -181,32 +175,31 @@ main() { |
group("toString()", () { |
group("byte asset", () { |
test("shows the list of bytes in hex", () { |
- var asset = new Asset.fromBytes(id, |
- [0, 1, 2, 4, 8, 16, 32, 64, 128, 255]); |
- expect(asset.toString(), equals( |
- "Bytes [00 01 02 04 08 10 20 40 80 ff]")); |
+ var asset = |
+ new Asset.fromBytes(id, [0, 1, 2, 4, 8, 16, 32, 64, 128, 255]); |
+ expect( |
+ asset.toString(), equals("Bytes [00 01 02 04 08 10 20 40 80 ff]")); |
}); |
test("truncates the middle of there are more than ten bytes", () { |
- var asset = new Asset.fromBytes(id, |
- [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); |
- expect(asset.toString(), equals( |
- "Bytes [01 02 03 04 05 ... 0a 0b 0c 0d 0e]")); |
+ var asset = new Asset.fromBytes( |
+ id, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]); |
+ expect(asset.toString(), |
+ equals("Bytes [01 02 03 04 05 ... 0a 0b 0c 0d 0e]")); |
}); |
}); |
group("string asset", () { |
test("shows the contents", () { |
var asset = new Asset.fromString(id, "contents"); |
- expect(asset.toString(), equals( |
- 'String "contents"')); |
+ expect(asset.toString(), equals('String "contents"')); |
}); |
test("truncates the middle of there are more than 40 characters", () { |
var asset = new Asset.fromString(id, |
"this is a fairly long string asset content that gets shortened"); |
- expect(asset.toString(), equals( |
- 'String "this is a fairly lon ... that gets shortened"')); |
+ expect(asset.toString(), |
+ equals('String "this is a fairly lon ... that gets shortened"')); |
}); |
}); |
@@ -235,14 +228,12 @@ main() { |
test("gets the raw bytes for a byte asset", () { |
var asset = new Asset.fromBytes(id, binaryContents); |
- expect(getBytesFromIsolate(asset), |
- completion(equals(binaryContents))); |
+ expect(getBytesFromIsolate(asset), completion(equals(binaryContents))); |
}); |
test("gets the raw bytes for a binary file", () { |
var asset = new Asset.fromPath(id, binaryFilePath); |
- expect(getBytesFromIsolate(asset), |
- completion(equals(binaryContents))); |
+ expect(getBytesFromIsolate(asset), completion(equals(binaryContents))); |
}); |
test("gets the raw bytes for a text file", () { |
@@ -252,8 +243,8 @@ main() { |
}); |
test("gets the raw bytes for a stream", () { |
- var asset = new Asset.fromStream(id, |
- new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™")))); |
+ var asset = new Asset.fromStream( |
+ id, new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™")))); |
expect(getBytesFromIsolate(asset), |
completion(equals(UTF8.encode("çøñ†éℵ™")))); |
}); |
@@ -262,7 +253,8 @@ main() { |
void _getAssetBytes(message) { |
var asset = deserializeAsset(message['asset']); |
- var builder = asset.read().fold(new BytesBuilder(), |
- (builder, chunk) => builder..add(chunk)); |
+ var builder = asset |
+ .read() |
+ .fold(new BytesBuilder(), (builder, chunk) => builder..add(chunk)); |
builder.then((builder) => message['replyTo'].send(builder.takeBytes())); |
} |