test-property-error-type Shiro Kawai (03 Apr 2024 22:54 UTC)
Re: test-property-error-type Antero Mejr (04 Apr 2024 01:04 UTC)
Re: test-property-error-type Shiro Kawai (04 Apr 2024 01:19 UTC)

Re: test-property-error-type Antero Mejr 04 Apr 2024 01:04 UTC

Yes for error predicates I would use test-property like your example, since it is more explicit.

The types for test-property-error-type are the same as in SRFI 64's test-error, for compatibility to port SRFI 64 tests to SRFI 252. But if I were writing new property tests I would prefer to use test-property always to have more control.

> On 04/04/2024 6:54 AM CST Shiro Kawai <xxxxxx@gmail.com> wrote:
>
>
> It is specified to take an error type argument (which follows SRFI-64).
> However, within R7RS and some SRFIs, error types are not explicit objects,
> but defined with a predicate (e.g. file-error? in R7RS, or
> unknown-encoding-error? in SRFI-181).
>
> Since this srfi assumes SRFI-64, we may be able to assume that the user can
> access specific error type objects.  That's mostly the case in Gauche.
> However, it prevents the user to portably test, say, the expression raises
> SRFI-181 unknown encoding error.
>
> Such tests can be written if test-property-error-type takes an error type
> predicate rather than an error type object.
>
> Of course, the user can also pass
>   (lambda (arg ...)
>      (guard (e ((unknown-encoding-error? e) #t))
>           (property arg ...)
>           #f))
> as the property argument of test-property to do the test, so it's the
> matter of convenience vs clarity.