guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with catching reader error


From: Andreas Rottmann
Subject: Re: Need help with catching reader error
Date: Wed, 22 Apr 2009 16:53:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Mike Gran <address@hidden> writes:

> Hi-
>
> Here's a puzzle for you.
>
> I want to write a test for the test suite to catch a lexical syntax
> error, like the following non-existent named character.  But I need to
> somehow introduce another layer of evaluation.  In the following, Guile
> would tell me that my test script has an error and then quit, instead of
> catching the error and moving on.
>
> (use-modules (test-suite lib))
>
> (define exception:read-error
>   (cons 'read-error "^.*"))
>
> (with-test-prefix "basic char handling"
>  (pass-if-exception "non-existent named character" 
>                   exception:read-error
>                   #\foobar))
>
You have a syntax error in your source script, which will hence not be
able to be read and consequently not be able to be evaluated.

Use this instead of #\foobar in the source text:

(with-input-from-string "#\\foobar" read)

This way, your source has legal syntax.

--Rotty




reply via email to

[Prev in Thread] Current Thread [Next in Thread]