Skip to content

Commit

Permalink
More precise comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Sep 19, 2022
1 parent d0a6856 commit 79a8161
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,12 @@ Future<void> main([List<String>? args]) async {
expect(players.indexOf(p, r.nextInt(index + 1) - 1), index++);
}

// indexOf with wrong type of element, just returns -1. Proof:
// List.indexOf with wrong type of element, just returns -1.
// Proof:
final dartList = <int>[1, 2, 3];
expect((dartList as List<Object>).indexOf("abc"), -1); // ignore: unnecessary_cast

// Realm list behaves differently
// .. but realm list behaves differently in this regard
expect(() => (players as List<Object>).indexOf(1), throwsA(isA<RealmException>())); // ignore: unnecessary_cast

expect(() => players.indexOf(Person('10')), throwsA(isA<RealmStateError>()));
Expand Down

0 comments on commit 79a8161

Please sign in to comment.