utest
utest copied to clipboard
eventually + assertMatch
Using a combination of eventually
and assertMatch
is currently rather inconvenient.
assertMatch
returns Unit
while eventually expects Boolean
.
So the following piece of code does not compile
eventually {
assertMatch(y) {
case Success(x: String) if x == "bla" =>
}
}
while this does but only with a manual true
as a workaround.
eventually {
assertMatch(y) {
case Success(x: String) if x == "bla" =>
}
true
}
Maybe an eventually
that only cares about match errors or a new eventuallyMatch
could be added?
In my opinion, the following should be plenty enough:
eventually {
assert(condition)
true
}
No need for assertThis, assertThat, assertWhatever. No need for eventuallyThis, eventuallyThat, eventuallyWhatever. If you seek the convenience of such this that whatever, you should employ ScalaTest instead, not uTest.
@frgomes Thanks for the friendly contribution. My point is that I don't think it should be necessary to add a manual true
after the assert. I would have expected my first code snippet to compile.
@NeQuissimus :: I certainly understand your point. My point is that uTest
should not be polluted with this, that, whatever just because API X has a certain function or syntax construct which happens to not look nice or convenient. You may have a myriad of circumstances where something may not look nice or convenient and, if we extend uTest
everytime something does not look nice or convenient, uTest
will soon look like ScalaTest
.