From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH v2] Add tests for warning locations. Date: Wed, 12 Oct 2022 22:40:26 +0200 Message-ID: <875ygovkqt.fsf@gnu.org> References: <20220924134608.20312-1-whatson@gmail.com> <20220924223426.30825-1-whatson@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28027"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) Cc: guile-devel@gnu.org To: Andrew Whatson Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Oct 12 22:41:27 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiiXe-00079V-Lk for guile-devel@m.gmane-mx.org; Wed, 12 Oct 2022 22:41:26 +0200 Original-Received: from localhost ([::1]:50772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiiXd-0003yW-8j for guile-devel@m.gmane-mx.org; Wed, 12 Oct 2022 16:41:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiiWj-0003y9-JV for guile-devel@gnu.org; Wed, 12 Oct 2022 16:40:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiiWj-0005UD-B9; Wed, 12 Oct 2022 16:40:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=bf5RSZCCG/im65LG1LZG0n5jNdYayaDlHsj/eA3P7HE=; b=q1Ti+M1wFhLrA/DXhpgm kV+OJE3FQQ8Kb+hHBnGcfQajrWEu7KrSGubt0TivOccNX87IcFbZT1U+TWdPy9QVMJEr5sB5vwwdr xfesdheCW43IfbH9meUm3WB/L23KXpnaporlMm7dRdbkhnjHADcdnnHQJ1Gsvom9Szrg5w52+JaVf fSYv16EvqYSx/3gMzmNPAlrCXz7hN6f0LxtekFookL6isx479sRhkTSZ/G/Xd+0UStMzOJoqYullo akb5O4BE0Jr6pjXrKS5Cgegpr3OgG+wMkqQhVBf8RVulUEybgbMkXTgRIQchxampdgM3RAQeLcA3B skkL6DJIT9Dx1w==; Original-Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:53749 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiiWi-0004BJ-QO; Wed, 12 Oct 2022 16:40:29 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Primidi 21 =?utf-8?Q?Vend=C3=A9miaire?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Chanvre X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu In-Reply-To: <20220924223426.30825-1-whatson@gmail.com> (Andrew Whatson's message of "Sun, 25 Sep 2022 08:34:27 +1000") X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21410 Archived-At: Hi, Andrew Whatson skribis: > These would have caught . > > * test-suite/Makefile.am (SCM_TESTS): Add sample code files. > * test-suite/tests/tree-il.test ("warnings"): New tests. > * test-suite/tests/tree-il/unbound-spaces.scm: > * test-suite/tests/tree-il/unbound-tabs.scm: > * test-suite/tests/tree-il/unused-variable.scm: Sample code for > compilation warning tests. The test looks great, thanks a lot! One minor nitpick and then we=E2=80=99re ready to go: > + (with-test-prefix "location" > + (define (test-file filename) > + (string-append > + (dirname (current-filename)) "/" filename)) > + > + (pass-if "unused variable" > + (let ((w (call-with-warnings > + (lambda () > + (compile-file (test-file "tree-il/unused-variable.scm= ") > + #:opts %opts-w-unused > + #:to 'cps))))) > + (and (=3D (length w) 1) > + (number? (string-contains (car w) "unused variable `y'")) > + (number? (string-contains (car w) "tree-il/unused-variable= .scm:2:2"))))) Can we avoid the separate files and instead do something like: (call-with-input-string " (foo)" (lambda (port) (set-port-filename! port "test-error-location.scm") (read-and-compile port #:opts =E2=80=A6 #:to 'cps))) ? Thanks, Ludo=E2=80=99.