unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Whatson <whatson@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH v2] Add tests for warning locations.
Date: Wed, 12 Oct 2022 22:40:26 +0200	[thread overview]
Message-ID: <875ygovkqt.fsf@gnu.org> (raw)
In-Reply-To: <20220924223426.30825-1-whatson@gmail.com> (Andrew Whatson's message of "Sun, 25 Sep 2022 08:34:27 +1000")

Hi,

Andrew Whatson <whatson@gmail.com> skribis:

> These would have caught <https://bugs.gnu.org/56493>.
>
> * 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’re 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 (= (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 … #:to 'cps)))

?

Thanks,
Ludo’.



  reply	other threads:[~2022-10-12 20:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24 13:46 [PATCH] Add tests for warning locations Andrew Whatson
2022-09-24 21:15 ` Maxime Devos
2022-09-24 22:34 ` [PATCH v2] " Andrew Whatson
2022-10-12 20:40   ` Ludovic Courtès [this message]
2022-10-13  3:12     ` [PATCH v3] " Andrew Whatson
2022-10-13  3:18     ` [PATCH v2] " Andrew Whatson
2022-11-29 18:11   ` [PATCH v3] " lloda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875ygovkqt.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=whatson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).