Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/matcher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.12.19-wip

* Improve speed of pretty printing for large collections.
* Improve output of pairwiseCompare with mismatched types.

## 0.12.18

Expand Down
3 changes: 2 additions & 1 deletion pkgs/matcher/lib/src/iterable_matchers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ class _PairwiseCompare<S, T> extends _IterableMatcher {
var i = 0;
for (var e in _expected) {
iterator.moveNext();
if (!_comparator(e, iterator.current as T)) {
var current = iterator.current;
if (current is! T || !_comparator(e, current)) {
addStateInfo(matchState, {
'index': i,
'expected': e,
Expand Down
11 changes: 11 additions & 0 deletions pkgs/matcher/test/iterable_matchers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,17 @@ void main() {
);
});

test('pairwiseCompare with mismatched types', () async {
final notInts = ['notInt'];
shouldFail(
notInts,
pairwiseCompare([1], (int e, int a) => a <= e, 'less than or equal'),
'Expected: pairwise less than or equal [1] '
"Actual: ['notInt'] "
"Which: has 'notInt' which is not less than or equal <1> at index 0",
);
});

test('isEmpty', () {
var d = SimpleIterable(0);
var e = SimpleIterable(1);
Expand Down
Loading