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

Unified Diff: test/registry_test.dart

Issue 955053002: adding codereview file, formatting, adding gitignore (Closed) Base URL: https://github.com/dart-lang/isolate.git@master
Patch Set: Created 5 years, 10 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
« test/ports_test.dart ('K') | « test/ports_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/registry_test.dart
diff --git a/test/registry_test.dart b/test/registry_test.dart
index 5e955228188bb73ace0732892f04dd84c251f84b..5727f04df9d23c57be77cd0f5aca24107caf6fb4 100644
--- a/test/registry_test.dart
+++ b/test/registry_test.dart
@@ -34,7 +34,6 @@ Future<List> waitAll(int n, Future action(int n)) {
}
void testLookup() {
-
test("lookupAll", () {
RegistryManager regman = new RegistryManager();
Registry registry = regman.registry;
@@ -42,14 +41,13 @@ void testLookup() {
var element = new Element(i);
var tag = i.isEven ? Oddity.EVEN : Oddity.ODD;
return registry.add(element, tags: [tag]);
- })
- .then((_) => registry.lookup())
- .then((all) {
+ }).then((_) => registry.lookup()).then((all) {
Lasse Reichstein Nielsen 2015/02/26 10:59:15 Less clear which operations are performed. The reg
expect(all.length, 10);
expect(all.map((v) => v.id).toList()..sort(),
- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
- })
- .then((_) { regman.close(); });
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+ }).then((_) {
+ regman.close();
+ });
});
test("lookupOdd", () {
@@ -59,14 +57,12 @@ void testLookup() {
var element = new Element(i);
var tag = i.isEven ? Oddity.EVEN : Oddity.ODD;
return registry.add(element, tags: [tag]);
- })
- .then((_) =>registry.lookup(tags:[Oddity.ODD]))
- .then((all) {
+ }).then((_) => registry.lookup(tags: [Oddity.ODD])).then((all) {
expect(all.length, 5);
- expect(all.map((v) => v.id).toList()..sort(),
- [1, 3, 5, 7, 9]);
- })
- .then((_) { regman.close(); });
+ expect(all.map((v) => v.id).toList()..sort(), [1, 3, 5, 7, 9]);
+ }).then((_) {
+ regman.close();
+ });
});
test("lookupMax", () {
@@ -76,12 +72,11 @@ void testLookup() {
var element = new Element(i);
var tag = i.isEven ? Oddity.EVEN : Oddity.ODD;
return registry.add(element, tags: [tag]);
- })
- .then((_) => registry.lookup(max: 5))
- .then((all) {
+ }).then((_) => registry.lookup(max: 5)).then((all) {
expect(all.length, 5);
- })
- .then((_) { regman.close(); });
+ }).then((_) {
+ regman.close();
+ });
});
test("lookupMultiTag", () {
@@ -95,14 +90,12 @@ void testLookup() {
if (i % j == 0) tags.add(j);
}
return registry.add(element, tags: tags);
- })
- .then((_) => registry.lookup(tags: [2, 3]))
- .then((all) {
+ }).then((_) => registry.lookup(tags: [2, 3])).then((all) {
expect(all.length, 5);
- expect(all.map((v) => v.id).toList()..sort(),
- [0, 6, 12, 18, 24]);
- })
- .then((_) { regman.close(); });
+ expect(all.map((v) => v.id).toList()..sort(), [0, 6, 12, 18, 24]);
+ }).then((_) {
+ regman.close();
+ });
});
test("lookupMultiTagMax", () {
@@ -116,13 +109,12 @@ void testLookup() {
if (i % j == 0) tags.add(j);
}
return registry.add(element, tags: tags);
- })
- .then((_) => registry.lookup(tags: [2, 3], max: 3))
- .then((all) {
+ }).then((_) => registry.lookup(tags: [2, 3], max: 3)).then((all) {
expect(all.length, 3);
expect(all.every((v) => (v.id % 6) == 0), isTrue);
- })
- .then((_) { regman.close(); });
+ }).then((_) {
+ regman.close();
+ });
});
}
@@ -146,8 +138,7 @@ void testAddLookup() {
var object2 = new Object();
var object3 = new Object();
var objects = [object1, object2, object3];
- return Future.wait(objects.map(registry.add))
- .then((_) {
+ return Future.wait(objects.map(registry.add)).then((_) {
return registry.lookup().then((entries) {
expect(entries, hasLength(3));
for (var entry in entries) {
@@ -216,7 +207,7 @@ void testAddLookup() {
var object1 = new Object();
var object2 = new Object();
var object3 = new Object();
- return registry.add(object1, tags: [1, 3, 5, 7]).then((_){
+ return registry.add(object1, tags: [1, 3, 5, 7]).then((_) {
return registry.add(object2, tags: [2, 3, 6, 7]);
}).then((_) {
return registry.add(object3, tags: [4, 5, 6, 7]);
@@ -330,7 +321,7 @@ void testAddRemoveTags() {
var object2 = new Object();
var object3 = new Object();
var objects = [object1, object2, object3];
- return Future.wait(objects.map(registry.add)).then((_){
+ return Future.wait(objects.map(registry.add)).then((_) {
return registry.addTags([object1, object2], ["x", "y"]);
}).then((_) {
return registry.addTags([object1, object3], ["z", "w"]);
@@ -351,8 +342,7 @@ void testAddRemoveTags() {
test("Remove-wrong-object", () {
RegistryManager regman = new RegistryManager();
Registry registry = regman.registry;
- expect(() => registry.removeTags([new Object()], ["x"]),
- throws);
+ expect(() => registry.removeTags([new Object()], ["x"]), throws);
regman.close();
});
}
@@ -373,8 +363,7 @@ void testCrossIsolate() {
// Add, lookup and remove object in other isolate.
return IsolateRunner.spawn().then((isolate) {
isolate.run(createRegMan, 1).then((registry) {
- return registry.add(object, tags: ["a", "b"])
- .then((removeCapability) {
+ return registry.add(object, tags: ["a", "b"]).then((removeCapability) {
return registry.lookup(tags: ["a"]).then((entries) {
expect(entries, hasLength(1));
expect(entries.first, same(object));
@@ -535,5 +524,5 @@ class Element {
final int id;
Element(this.id);
int get hashCode => id;
- bool operator==(Object other) => other is Element && id == other.id;
+ bool operator ==(Object other) => other is Element && id == other.id;
}
« test/ports_test.dart ('K') | « test/ports_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698