{"size": 1946, "ext": "rktl", "max_stars_repo_path": "pkgs/racket-test-core/tests/racket/setup.rktl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-05T21:18:24.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-04T14:48:37.000Z", "max_issues_repo_path": "pkgs/racket-test-core/tests/racket/setup.rktl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-05-10T07:33:20.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-19T15:49:46.000Z", "max_forks_repo_path": "pkgs/racket-test-core/tests/racket/setup.rktl", "max_forks_repo_name": "lkh01/racket", "max_forks_repo_forks_event_min_datetime": "2016-04-25T11:47:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-09T14:52:48.000Z"}
{"max_stars_count": 4, "max_issues_count": 9, "max_forks_count": 3, "avg_line_length": 38.1568627451, "max_line_length": 95, "alphanum_fraction": 0.5924974306}
(load-relative "loadtest.rktl")

(Section 'setup)

;; ----------------------------------------

(require setup/path-to-relative)

(let ([missing   "/some/inexistent/path"]
      [collects  (build-path (path-only (collection-file-path "main.rkt" "racket")) "foo.rkt")]
      [relative  "some/path"])
  (define (test-both path/str expected-str [lib-expected expected-str])
    (define str  (if (string? path/str) path/str (path->string path/str)))
    (define path (string->path str))
    (test expected-str path->relative-string/setup str)
    (test expected-str path->relative-string/setup path)
    (test lib-expected path->relative-string/library str)
    (test lib-expected path->relative-string/library path))
  (test-both missing  missing)
  (test-both relative relative)
  (test-both collects "<collects>/racket/foo.rkt" "<collects>/racket/foo.rkt")
  (err/rt-test (path->relative-string/setup #f))
  (err/rt-test (path->relative-string/setup #"bleh"))
  (err/rt-test (path->relative-string/setup 'bleh)))

;; ----------------------------------------

(require setup/collects)

(for ([i '([("main.rkt" "racket") (lib "racket/main.rkt")]
           [("reader.rkt" "scribble") (lib "scribble/reader.rkt")])])
  (define p (apply collection-file-path (car i)))
  (test (cadr i) path->module-path p)
  (let ([out (build-path (let-values ([(base name dir?) (split-path p)])
                           base)
                         "../info.rkt")])
    (test out path->module-path out)))
(test "a/b" path->module-path "a/b")
(test (find-system-path 'temp-dir) path->module-path (find-system-path 'temp-dir))

;; ----------------------------------------
;; Make sure that setting the reader doesn't break reading a configuration file:

(parameterize ([current-namespace (make-base-namespace)]
               [read-accept-dot #f])
  ((dynamic-require 'setup/dirs 'get-pkgs-search-dirs)))

;; ----------------------------------------

(report-errs)
