[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] Add tests for warning locations.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH v2] Add tests for warning locations. |
Date: |
Wed, 12 Oct 2022 22:40:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
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’.
- Re: [PATCH v2] Add tests for warning locations.,
Ludovic Courtès <=