Skip to content

Commit cec3b9c

Browse files
committed
fix(built_value_test): respect non comparable fields
Signed-off-by: Nikolas Rimikis <[email protected]>
1 parent 153e6ba commit cec3b9c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

built_value_test/lib/matcher.dart

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class _BuiltValueMatcher implements Matcher {
4141
bool matches(dynamic item, Map matchState) {
4242
if (_expected.runtimeType != item.runtimeType) return false;
4343

44+
if (_expected == item) return true;
45+
4446
return _delegate.matches(_toMap(item), matchState);
4547
}
4648
}

built_value_test/test/matcher_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void main() {
103103
..name = 'foo'
104104
..onChanged = () => 'Change happened!');
105105

106-
expect(value, otherValue);
106+
expect(value, equalsBuilt(otherValue));
107107
});
108108

109109
test('compared value matcher with different onChanged outcomes', () {
@@ -114,7 +114,7 @@ void main() {
114114
..name = 'foo'
115115
..onChanged = () => 'Change did not happen!');
116116

117-
expect(value, otherValue);
117+
expect(value, equalsBuilt(otherValue));
118118
});
119119

120120
test('compared value matcher with different names', () {

0 commit comments

Comments
 (0)