From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Rottmann Newsgroups: gmane.lisp.guile.devel Subject: Re: Need help with catching reader error Date: Wed, 22 Apr 2009 16:53:16 +0200 Message-ID: <877i1cspsz.fsf@delenn.lan> References: <1240410767.3133.109.camel@localhost.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1240412081 7728 80.91.229.12 (22 Apr 2009 14:54:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Apr 2009 14:54:41 +0000 (UTC) Cc: Guile Devel To: Mike Gran Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Apr 22 16:56:01 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lwdqj-0003wF-Sm for guile-devel@m.gmane.org; Wed, 22 Apr 2009 16:54:58 +0200 Original-Received: from localhost ([127.0.0.1]:52911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LwdpL-0004nW-0h for guile-devel@m.gmane.org; Wed, 22 Apr 2009 10:53:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LwdpI-0004mp-3V for guile-devel@gnu.org; Wed, 22 Apr 2009 10:53:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LwdpD-0004kN-Me for guile-devel@gnu.org; Wed, 22 Apr 2009 10:53:27 -0400 Original-Received: from [199.232.76.173] (port=35708 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LwdpD-0004kF-Ba for guile-devel@gnu.org; Wed, 22 Apr 2009 10:53:23 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:51096) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LwdpC-00088V-Jn for guile-devel@gnu.org; Wed, 22 Apr 2009 10:53:22 -0400 Original-Received: (qmail invoked by alias); 22 Apr 2009 14:53:20 -0000 Original-Received: from 83-215-154-5.hage.dyn.salzburg-online.at (EHLO nathot.lan) [83.215.154.5] by mail.gmx.net (mp033) with SMTP; 22 Apr 2009 16:53:20 +0200 X-Authenticated: #3102804 X-Provags-ID: V01U2FsdGVkX1/L2WB4vybLtT4VjcVMaN+eDTrxIbmyNXAukids61 GEOZnPIQvOTFsx Original-Received: by nathot.lan (Postfix, from userid 121) id A1E973A68F; Wed, 22 Apr 2009 16:53:18 +0200 (CEST) Original-Received: from delenn.lan (delenn.lan [192.168.1.11]) by nathot.lan (Postfix) with ESMTPS id 5D6503A672; Wed, 22 Apr 2009 16:53:17 +0200 (CEST) Original-Received: from rotty by delenn.lan with local (Exim 4.69) (envelope-from ) id 1Lwdp6-0003MZ-C8; Wed, 22 Apr 2009 16:53:16 +0200 In-Reply-To: <1240410767.3133.109.camel@localhost.localdomain> (Mike Gran's message of "Wed, 22 Apr 2009 07:32:47 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.67 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8446 Archived-At: Mike Gran 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