isSomeOf function
Matcher that matches with a Some instance whose underlying value is equal
to expected
. Equality is tested with ==
Example :
The following test is successfull
Option option = Some(0);
expect(option, isSomeOf(0));
expect(option, isNot(isSomeOf(42)));
This matcher hasn't the same behavior than the equals
matcher when
comparing the two values :
test(
"`isSomeOf` works with == and not the `equals` matcher",
() {
var list1 = ['foo'];
var list2 = ['foo'];
Either either = Right(list1);
//! Because list1 != list2, this line doesn't pass the test
expect(either, isSomeOf(list2));
// Use `isSomeThat` instead
expect(either, isSomeThat(equals(list2)));
}
)
Implementation
Matcher isSomeOf(Object expected) => _IsSomeOf(expected);