Commit f79da85
committed
Add a function to Equivalence for convenient conversion to a TestResult
`quickcheck` allows to skip tests (for given inputs) by returning a
`TestResult` indicating that it should be ignored. Naturally, an
`Equivalence` cannot express such an intent and neither can any other
`Testable`s other than functions and `TestResult` itself. Hence, if we
need the ability to skip tests, we need to return a `TestResult` or some
dependent type (e.g. `Result<TestResult>`) from our property function.
If we still want to make use of `Equivalence` in such tests, we need to
convert it to a `TestResult`. Previously, we had to resort to using
`Testable::result` with some dummy `&mut Gen`, even though it isn't even
used in the conversion. As a remedy, this change moves the conversion
into a dedicates function (with no additional parameters) which may be
called inside property functions.1 parent feaa4ed commit f79da85
1 file changed
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
356 | 373 | | |
357 | 374 | | |
358 | 375 | | |
| |||
393 | 410 | | |
394 | 411 | | |
395 | 412 | | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 413 | + | |
404 | 414 | | |
405 | 415 | | |
406 | 416 | | |
| |||
0 commit comments