From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: Test coverage of libguile Date: Tue, 03 Nov 2009 21:53:38 +0000 Message-ID: <87hbtb8ecd.fsf@ossau.uklinux.net> References: <87skd3bdw8.fsf@gnu.org> <877huf9qxh.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1257285244 19565 80.91.229.12 (3 Nov 2009 21:54:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Nov 2009 21:54:04 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Nov 03 22:53:57 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 1N5RK8-0004te-1m for guile-devel@m.gmane.org; Tue, 03 Nov 2009 22:53:57 +0100 Original-Received: from localhost ([127.0.0.1]:34604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5RK7-0007ae-Er for guile-devel@m.gmane.org; Tue, 03 Nov 2009 16:53:55 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N5RK0-0007aK-CY for guile-devel@gnu.org; Tue, 03 Nov 2009 16:53:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N5RJw-0007Zj-Is for guile-devel@gnu.org; Tue, 03 Nov 2009 16:53:48 -0500 Original-Received: from [199.232.76.173] (port=60143 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5RJw-0007Zg-FU for guile-devel@gnu.org; Tue, 03 Nov 2009 16:53:44 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]:54862) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N5RJs-0004wi-Se; Tue, 03 Nov 2009 16:53:41 -0500 Original-Received: from arudy (host86-147-112-196.range86-147.btcentralplus.com [86.147.112.196]) by mail3.uklinux.net (Postfix) with ESMTP id 0CF341F679A; Tue, 3 Nov 2009 21:53:40 +0000 (GMT) Original-Received: from arudy (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id BEA7238024; Tue, 3 Nov 2009 21:53:38 +0000 (GMT) In-Reply-To: <877huf9qxh.fsf@ossau.uklinux.net> (Neil Jerram's message of "Wed, 28 Oct 2009 20:58:18 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 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:9627 Archived-At: --=-=-= Neil Jerram writes: > it. I will do some of that myself, but patches are welcome from > everyone! (Less than 10 lines doesn't need copyright assignment...) Attached, for review, are some new tests for continuations and keywords. Neil --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fill-code-coverage-holes-in-continuations.c-and-keyw.patch >From fb907a1c4b2b579045b630565772f2567f23230a Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Tue, 3 Nov 2009 21:51:28 +0000 Subject: [PATCH] Fill code coverage holes in continuations.c and keywords.c * test-suite/Makefile.am (SCM_TESTS): Add tests/keywords.test. * test-suite/standalone/Makefile.am (test-loose-ends): New test. * test-suite/standalone/test-loose-ends.c: New file. * test-suite/tests/continuations.test: Three new tests. * test-suite/tests/keywords.test: New file. --- test-suite/Makefile.am | 1 + test-suite/standalone/Makefile.am | 7 ++++ test-suite/standalone/test-loose-ends.c | 56 +++++++++++++++++++++++++++++++ test-suite/tests/continuations.test | 28 +++++++++++++++ test-suite/tests/keywords.test | 30 ++++++++++++++++ 5 files changed, 122 insertions(+), 0 deletions(-) create mode 100644 test-suite/standalone/test-loose-ends.c create mode 100644 test-suite/tests/keywords.test diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index 145975c..d08aab7 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -48,6 +48,7 @@ SCM_TESTS = tests/alist.test \ tests/i18n.test \ tests/import.test \ tests/interp.test \ + tests/keywords.test \ tests/list.test \ tests/load.test \ tests/modules.test \ diff --git a/test-suite/standalone/Makefile.am b/test-suite/standalone/Makefile.am index 1b0d9d6..17ac1e7 100644 --- a/test-suite/standalone/Makefile.am +++ b/test-suite/standalone/Makefile.am @@ -107,6 +107,13 @@ test_conversion_LDADD = ${top_builddir}/libguile/libguile.la check_PROGRAMS += test-conversion TESTS += test-conversion +# test-loose-ends +test_loose_ends_SOURCES = test-loose-ends.c +test_loose_ends_CFLAGS = ${test_cflags} +test_loose_ends_LDADD = ${top_builddir}/libguile/libguile.la +check_PROGRAMS += test-loose-ends +TESTS += test-loose-ends + # test-fast-slot-ref check_SCRIPTS += test-fast-slot-ref TESTS += test-fast-slot-ref diff --git a/test-suite/standalone/test-loose-ends.c b/test-suite/standalone/test-loose-ends.c new file mode 100644 index 0000000..2fdbe7d --- /dev/null +++ b/test-suite/standalone/test-loose-ends.c @@ -0,0 +1,56 @@ +/* test-loose-ends.c + * + * Test items of the Guile C API that aren't covered by any other tests. + */ + +/* Copyright (C) 2009 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#if HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include +#include + +#ifdef HAVE_INTTYPES_H +# include +#endif + +static void +test_scm_from_locale_keywordn () +{ + SCM kw = scm_from_locale_keywordn ("thusly", 4); + assert (scm_is_true (scm_keyword_p (kw))); +} + +static void +tests (void *data, int argc, char **argv) +{ + test_scm_from_locale_keywordn (); +} + +int +main (int argc, char *argv[]) +{ + scm_boot_guile (argc, argv, tests, NULL); + return 0; +} diff --git a/test-suite/tests/continuations.test b/test-suite/tests/continuations.test index 20a7a5a..d96274e 100644 --- a/test-suite/tests/continuations.test +++ b/test-suite/tests/continuations.test @@ -52,6 +52,34 @@ (pass-if "throwing to a rewound catch context" (eq? (dont-crash-please) 'no-reentry)) + (pass-if "can print a continuation" + (let ((s (with-output-to-string + (lambda () + (call-with-current-continuation write))))) + (string=? "#