Fix test: use a new directory for the submodule tests
This commit is contained in:
parent
89b9ad0dde
commit
4adc10b071
|
@ -515,10 +515,18 @@
|
||||||
|
|
||||||
(test 10 dynamic-require '(submod 'subm-all-defined-1 main) 'x)
|
(test 10 dynamic-require '(submod 'subm-all-defined-1 main) 'x)
|
||||||
|
|
||||||
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Directory for testing
|
||||||
|
|
||||||
|
(define temp-dir
|
||||||
|
(build-path (find-system-path 'temp-dir)
|
||||||
|
(format "submodule-tests-~s" (current-seconds))))
|
||||||
|
(make-directory temp-dir)
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Check submodule resolution of relative paths:
|
;; Check submodule resolution of relative paths:
|
||||||
|
|
||||||
(parameterize ([current-load-relative-directory (find-system-path 'temp-dir)])
|
(parameterize ([current-load-relative-directory temp-dir])
|
||||||
(define p (collection-file-path "has-submod.rkt" "tests" "racket"))
|
(define p (collection-file-path "has-submod.rkt" "tests" "racket"))
|
||||||
(dynamic-require p #f)
|
(dynamic-require p #f)
|
||||||
(test 'for-submod dynamic-require `(submod ,p main) 'has-submod))
|
(test 'for-submod dynamic-require `(submod ,p main) 'has-submod))
|
||||||
|
@ -533,10 +541,8 @@
|
||||||
`(module+ ,n
|
`(module+ ,n
|
||||||
(define name ',n)
|
(define name ',n)
|
||||||
(provide name)))))
|
(provide name)))))
|
||||||
(define fn (build-path (find-system-path 'temp-dir)
|
(define fn (build-path temp-dir "has-submod.rkt"))
|
||||||
"has-submod.rkt"))
|
(define dir (build-path temp-dir "compiled"))
|
||||||
(define dir (build-path (find-system-path 'temp-dir)
|
|
||||||
"compiled"))
|
|
||||||
(define fn-zo (build-path dir "has-submod_rkt.zo"))
|
(define fn-zo (build-path dir "has-submod_rkt.zo"))
|
||||||
(unless (directory-exists? dir) (make-directory dir))
|
(unless (directory-exists? dir) (make-directory dir))
|
||||||
(with-output-to-file fn-zo
|
(with-output-to-file fn-zo
|
||||||
|
@ -548,6 +554,15 @@
|
||||||
(try-submods '(xa xb))
|
(try-submods '(xa xb))
|
||||||
(try-submods '(test main)))
|
(try-submods '(test main)))
|
||||||
|
|
||||||
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Delete the temp-dir
|
||||||
|
|
||||||
|
(let loop ([x temp-dir])
|
||||||
|
(cond [(file-exists? x) (delete-file x)]
|
||||||
|
[(directory-exists? x) (parameterize ([current-directory x])
|
||||||
|
(for-each loop (directory-list)))
|
||||||
|
(delete-directory x)]))
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(report-errs)
|
(report-errs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user