forked from alex-eg/sex
share reading a test source and catching its error
encapsulation.scm had copies of both from codegen.scm.
This commit is contained in:
@@ -5,23 +5,18 @@
|
||||
;;; is checked here is what the compiler refuses, and that it refuses
|
||||
;;; it with the name of whatever is wrong.
|
||||
;;;
|
||||
;;; `sex->c', `emits?', `reports?' and `in-fn' come from codegen.scm,
|
||||
;;; which run.scm includes first.
|
||||
;;; `sex->c', `read-source', `failure-message', `emits?', `reports?'
|
||||
;;; and `in-fn' come from codegen.scm, which run.scm includes first.
|
||||
|
||||
(import sex-modules)
|
||||
|
||||
(define (interface-of source)
|
||||
"The declarations SOURCE, compiled as a module, hands its importers
|
||||
ahead of its pub forms."
|
||||
(check-public-interface
|
||||
(with-input-from-string source
|
||||
(lambda ()
|
||||
(parameterize ((current-source-file "codegen.sex"))
|
||||
(parse-all (current-input-port)))))))
|
||||
(check-public-interface (read-source source)))
|
||||
|
||||
(define (interface-reports? source fragment)
|
||||
(let ((m (handle-exceptions e ((condition-property-accessor 'exn 'message) e)
|
||||
(begin (interface-of source) #f))))
|
||||
(let ((m (failure-message (lambda () (interface-of source)))))
|
||||
(and m (string-contains m fragment) #t)))
|
||||
|
||||
(define (ops-src . body)
|
||||
|
||||
Reference in New Issue
Block a user