[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] Add tests for warning locations.
From: |
Andrew Whatson |
Subject: |
Re: [PATCH v2] Add tests for warning locations. |
Date: |
Thu, 13 Oct 2022 13:18:48 +1000 |
Ludovic Courtès <ludo@gnu.org> wrote:
>
> 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)))
>
> ?
That cleans things up nicely! I've sent v3 of the patch incorporating
this change.
Thanks for the review!
Cheers,
Andrew