Mike Gran <spk...@yahoo.com> 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