Skip to content

Commit

Permalink
Avoid analysis tests on very old versions of Racket
Browse files Browse the repository at this point in the history
  • Loading branch information
greghendershott committed Jan 13, 2025
1 parent 2dfb883 commit fb060a1
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions racket/commands/requires.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

(module+ test
(require rackunit
racket/format))
racket/format
version/utils))

(define (requires/tidy path-str)
(tidy-file path-str))
Expand All @@ -42,33 +43,41 @@
#:drops (drops a)))

(module+ test
(define p (path->string
(simple-form-path
(build-path 'up 'up "test" "example" "requires.rkt"))))
(check-equal?
(requires/tidy p)
'((delete 174 17)
(replace
129
44
"(require net/url\n (combine-in net/url\n racket/format))")
(replace 39 42 "(require net/uri-codec\n net/url)")))
(check-equal?
(requires/trim p)
'((delete 174 17)
(replace
129
44
"(require net/url\n (combine-in net/url\n racket/format))")
(replace 39 42 "(require net/uri-codec\n net/url)")))
(check-equal?
(requires/base p)
'((delete 174 17)
(replace
129
44
"(require (for-syntax racket/base)\n net/url\n (combine-in net/url\n racket/format)\n racket/list\n racket/match)")
(replace 39 42 "(require net/uri-codec\n net/url)"))))
(let ([p (path->string
(simple-form-path
(build-path 'up 'up "test" "example" "requires.rkt")))])
(check-equal?
(requires/tidy p)
'((delete 174 17)
(replace
129
44
"(require net/url\n (combine-in net/url\n racket/format))")
(replace 39 42 "(require net/uri-codec\n net/url)")))

;; On older Rackets macro-debugger/analysis/check-requires might
;; give error:
;;
;; derivation-parser: error on token #2: <local-value,
;;#<syntax:/usr/share/racket/collects/syntax/parse/private/lib.rkt:63:55
;;-string>>
(when (version<=? "8.14" (version))
(check-equal?
(requires/trim p)
'((delete 174 17)
(replace
129
44
"(require net/url\n (combine-in net/url\n racket/format))")
(replace 39 42 "(require net/uri-codec\n net/url)")))
(check-equal?
(requires/base p)
'((delete 174 17)
(replace
129
44
"(require (for-syntax racket/base)\n net/url\n (combine-in net/url\n racket/format)\n racket/list\n racket/match)")
(replace 39 42 "(require net/uri-codec\n net/url)"))))))

;;; analysis by macro-debugger/analysis/check-requires

Expand Down

0 comments on commit fb060a1

Please sign in to comment.