Index: packages/quiver/test/collection/collection_test.dart |
diff --git a/packages/quiver/test/collection/collection_test.dart b/packages/quiver/test/collection/collection_test.dart |
index c5fc143a31918009bd5cc9d0a6d7b9a734c602a6..80b84127e0ae4bddbc321b1512d0f68de3f487c4 100644 |
--- a/packages/quiver/test/collection/collection_test.dart |
+++ b/packages/quiver/test/collection/collection_test.dart |
@@ -69,4 +69,17 @@ main() { |
expect(setsEqual(new Set(), new Set.from([1])), isFalse); |
}); |
}); |
+ |
+ group('indexOf', () { |
+ test('returns the first matching index', () { |
+ expect(indexOf<int>([1, 12, 19, 20, 24], (n) => n % 2 == 0), 1); |
+ expect(indexOf<String>(['a', 'b', 'a'], (s) => s == 'a'), 0); |
+ }); |
+ |
+ test('returns -1 when there is no match', () { |
+ expect(indexOf<int>([1, 3, 7], (n) => n % 2 == 0), -1); |
+ expect(indexOf<String>(['a', 'b'], (s) => s == 'e'), -1); |
+ expect(indexOf<bool>([], (_) => true), -1); |
+ }); |
+ }); |
} |