OLD | NEW |
1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }); | 62 }); |
63 | 63 |
64 test('return false for non-equal sets', () { | 64 test('return false for non-equal sets', () { |
65 expect(setsEqual(null, new Set()), isFalse); | 65 expect(setsEqual(null, new Set()), isFalse); |
66 expect(setsEqual(new Set(), null), isFalse); | 66 expect(setsEqual(new Set(), null), isFalse); |
67 expect(setsEqual(new Set.from([1]), new Set.from([2])), isFalse); | 67 expect(setsEqual(new Set.from([1]), new Set.from([2])), isFalse); |
68 expect(setsEqual(new Set.from([1]), new Set()), isFalse); | 68 expect(setsEqual(new Set.from([1]), new Set()), isFalse); |
69 expect(setsEqual(new Set(), new Set.from([1])), isFalse); | 69 expect(setsEqual(new Set(), new Set.from([1])), isFalse); |
70 }); | 70 }); |
71 }); | 71 }); |
| 72 |
| 73 group('indexOf', () { |
| 74 test('returns the first matching index', () { |
| 75 expect(indexOf<int>([1, 12, 19, 20, 24], (n) => n % 2 == 0), 1); |
| 76 expect(indexOf<String>(['a', 'b', 'a'], (s) => s == 'a'), 0); |
| 77 }); |
| 78 |
| 79 test('returns -1 when there is no match', () { |
| 80 expect(indexOf<int>([1, 3, 7], (n) => n % 2 == 0), -1); |
| 81 expect(indexOf<String>(['a', 'b'], (s) => s == 'e'), -1); |
| 82 expect(indexOf<bool>([], (_) => true), -1); |
| 83 }); |
| 84 }); |
72 } | 85 } |
OLD | NEW |