forked from alex-eg/sex
look for an import beside the file it is written in
Imports were looked for from the unit's directory, so a module in a subdirectory could not import its neighbours: a pub import failed, a private one lost its handle declarations, and --public-interface changed with where sexc ran.
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
;;; and ledger, which only greet does but which decides what the app is
|
||||
;;; told of it.
|
||||
;;;
|
||||
;;; A module in a directory of its own finds its imports beside itself,
|
||||
;;; not beside the unit importing it: shelf-app imports shelf/book, and
|
||||
;;; book its siblings page, with `pub', and spine, without.
|
||||
;;;
|
||||
;;; make check-modules
|
||||
|
||||
(import scheme
|
||||
@@ -80,6 +84,20 @@
|
||||
(and (irregex-match ".*\\.sex:" line) (pathname-strip-directory line)))
|
||||
(call-with-input-file (built "greet-app.d") read-lines)))
|
||||
|
||||
(test "a module's interface does not depend on where sexc runs"
|
||||
'("(record spine)" "(import page)")
|
||||
(take (or (output-of sexc "--public-interface" "shelf/book.sex") '()) 2))
|
||||
|
||||
(test-assert "a module in a directory finds its imports beside itself"
|
||||
(and (output-of sexc "shelf/page.sex" "-c" "-o" (built "page.o"))
|
||||
(output-of sexc "shelf/book.sex" "-c" "-o" (built "book.o"))
|
||||
(output-of sexc "shelf-app.sex" "-o" (built "shelf-app")
|
||||
"--" (built "book.o") (built "page.o"))))
|
||||
|
||||
(test "and the app runs through it"
|
||||
'("pages 2 3")
|
||||
(output-of (built "shelf-app")))
|
||||
|
||||
(test "the app runs through both"
|
||||
'("hello, world"
|
||||
"hello, sex"
|
||||
|
||||
Reference in New Issue
Block a user