unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* srfi-64 apathetic test-error
@ 2019-10-23  4:37 Christopher Howard
  2019-10-24 16:18 ` Taylan Kammer
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Howard @ 2019-10-23  4:37 UTC (permalink / raw)
  To: Guile User

Hi, I was just wondering: `test-error' from (srfi srfi-64) gives a pass
if it catches an exception, but it doesn't seem to care whether or not
the exception caught matches what you told it to expect. Is this a bug?


-- 
Christopher Howard
p: +1 (907) 374-0257
w: https://librehacker.com
social feed: https://gnusocial.club/librehacker
xmpp: creationist@member.fsf.org
otr: E9685B53 01F038DD D29281C9 30FDA71E BD0095D4
gnupg: 23FD5CC5 (keys.gnupg.net)
radio: KL1TL
featured: https://answersingenesis.org/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: srfi-64 apathetic test-error
  2019-10-23  4:37 srfi-64 apathetic test-error Christopher Howard
@ 2019-10-24 16:18 ` Taylan Kammer
  2019-10-24 16:21   ` John Cowan
  2019-10-24 16:50   ` Taylan Kammer
  0 siblings, 2 replies; 4+ messages in thread
From: Taylan Kammer @ 2019-10-24 16:18 UTC (permalink / raw)
  To: guile-user

On 23.10.2019 06:37, Christopher Howard wrote:
> Hi, I was just wondering: `test-error' from (srfi srfi-64) gives a pass
> if it catches an exception, but it doesn't seem to care whether or not
> the exception caught matches what you told it to expect. Is this a bug?

The (test-error ...) form takes an optional "error-type" operand.  It
can be an arbitrary predicate (one-argument procedure that returns a
Boolean value) which tests if the error is the expected kind.

See here for a complete documentation of the SRFI-64 API:

    https://srfi.schemers.org/srfi-64/srfi-64.html

- Taylan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: srfi-64 apathetic test-error
  2019-10-24 16:18 ` Taylan Kammer
@ 2019-10-24 16:21   ` John Cowan
  2019-10-24 16:50   ` Taylan Kammer
  1 sibling, 0 replies; 4+ messages in thread
From: John Cowan @ 2019-10-24 16:21 UTC (permalink / raw)
  To: Taylan Kammer; +Cc: guile-user

Note however that such error tests are inherently non-portable (except in
R6RS systems only) and should be avoided when testing code intended to be
portable.

On Thu, Oct 24, 2019 at 12:20 PM Taylan Kammer <taylan.kammer@gmail.com>
wrote:

> On 23.10.2019 06:37, Christopher Howard wrote:
> > Hi, I was just wondering: `test-error' from (srfi srfi-64) gives a pass
> > if it catches an exception, but it doesn't seem to care whether or not
> > the exception caught matches what you told it to expect. Is this a bug?
>
> The (test-error ...) form takes an optional "error-type" operand.  It
> can be an arbitrary predicate (one-argument procedure that returns a
> Boolean value) which tests if the error is the expected kind.
>
> See here for a complete documentation of the SRFI-64 API:
>
>     https://srfi.schemers.org/srfi-64/srfi-64.html
>
> - Taylan
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: srfi-64 apathetic test-error
  2019-10-24 16:18 ` Taylan Kammer
  2019-10-24 16:21   ` John Cowan
@ 2019-10-24 16:50   ` Taylan Kammer
  1 sibling, 0 replies; 4+ messages in thread
From: Taylan Kammer @ 2019-10-24 16:50 UTC (permalink / raw)
  To: guile-user; +Cc: christopher

Sorry, I said something wrong in my previous email.

The SRFI-64 specification does not mention the possibility of providing
an arbitrary predicate.  That's a feature supported by my R7RS-based
implementation of SRFI-64:

    https://github.com/TaylanUB/scheme-srfis/tree/master/srfi/64

(The file 'execution.body.scm' contains most of the logic.)

I've tried to figure out what the reference implementation supports but
the code is overly complicated.  There's a comment saying "TODO: decide
how to specify expected error types for Guile" which makes me think it
doesn't support Guile that well.  I think it doesn't actually use the
"error-type" information at all in the case of Guile and just matches
all errors it catches and considers them correct.  See lines 800 to 818
here:


http://git.savannah.gnu.org/cgit/guile.git/tree/module/srfi/srfi-64/testing.scm

Last time I suggested Guile to adopt my SRFI-64 implementation, it was
argued against on the grounds that it's not been around as long as the
reference implementation and therefore possibly less stable.  Maybe I
should try again, because IMO the reference implementation is written in
a terrible style that makes it very difficult to comprehend and improve.

- Taylan


On 24.10.2019 18:18, Taylan Kammer wrote:
> On 23.10.2019 06:37, Christopher Howard wrote:
>> Hi, I was just wondering: `test-error' from (srfi srfi-64) gives a pass
>> if it catches an exception, but it doesn't seem to care whether or not
>> the exception caught matches what you told it to expect. Is this a bug?
> 
> The (test-error ...) form takes an optional "error-type" operand.  It
> can be an arbitrary predicate (one-argument procedure that returns a
> Boolean value) which tests if the error is the expected kind.
> 
> See here for a complete documentation of the SRFI-64 API:
> 
>     https://srfi.schemers.org/srfi-64/srfi-64.html
> 
> - Taylan
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-24 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-23  4:37 srfi-64 apathetic test-error Christopher Howard
2019-10-24 16:18 ` Taylan Kammer
2019-10-24 16:21   ` John Cowan
2019-10-24 16:50   ` Taylan Kammer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).