Hi, Andrew Whatson <what...@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’.