commit
1a9a68b2ef
|
@ -1,17 +1,14 @@
|
|||
#lang racket/base
|
||||
(provide ->relative ->absolute)
|
||||
(require racket/list)
|
||||
(require racket/list racket/path)
|
||||
(module+ test (require rackunit))
|
||||
|
||||
;; PathString -> Path
|
||||
(define (->relative path)
|
||||
(simplify-path
|
||||
(if (relative-path? path)
|
||||
(build-path path)
|
||||
(let-values ([(_ lst)
|
||||
(split-at (explode-path path)
|
||||
(length (explode-path (current-directory))))])
|
||||
(apply build-path lst)))))
|
||||
(build-path
|
||||
(find-relative-path
|
||||
(current-directory)
|
||||
path)))
|
||||
|
||||
(module+ test
|
||||
(parameterize ([current-directory (build-path "/test")])
|
||||
|
|
2
raco.rkt
2
raco.rkt
|
@ -229,7 +229,7 @@
|
|||
paths))
|
||||
|
||||
(module+ test
|
||||
(parameterize ([current-directory (build-path "/tests")])
|
||||
(parameterize ([current-directory (build-path "/test")])
|
||||
(check-not-false (is-excluded-path? "/test/test/x.rkt" '("test")))
|
||||
(check-false (is-excluded-path? "/test/x.rkt" '("test")))
|
||||
(check-false (is-excluded-path? "/test/t/x.rkt" '("test")))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user