Skip to content

Commit

Permalink
Add some basic smoke tests for doc-index-lookup
Browse files Browse the repository at this point in the history
These are a few basic tests intended to check that things still work
with the "classic" index structs, as well as with the new ones.

Also, when rhombus is installed, we can add a few more tests, to see
e.g. if we get more interesting kinds than "value" for it, such as
"regular expression operator".

Note that these rhombus tests won't run on CI unless we change CI to
install the rhombus package, which I'm considering but would be a
future commit.
  • Loading branch information
greghendershott committed Oct 4, 2024
1 parent 34eeef6 commit 9ee47f6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions racket/scribble.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,48 @@
[v v])]
[(cons term _) term]))))

(module+ test
(define older?
(not (dynamic-require 'scribble/manual-struct 'index-desc? (λ () #f))))
(let ([results (doc-index-lookup "match")])
(check-true (for/or ([v (in-list results)])
(match v
[(list "match" "syntax" "racket/match, racket" family
_path _anchor)
(equal? family (if older? "" "Racket"))]
[_ #f])))
(when (rhombus-installed?)
(check-true (for/or ([v (in-list results)])
(match v
[(list "match" kind "rhombus" family
_path _anchor)
(and (equal? family (if older? "" "Rhombus"))
(equal? kind (if older? "value" "expression")))]
[_ #f])))))
(let ([results (doc-index-lookup "set-label")])
(check-true (for/or ([v (in-list results)])
(match v
[(list "set-label" "method of message%" "racket/gui/base, racket/gui" family
_path _anchor)
(equal? family (if older? "" "Racket"))]
[_ #f]))))
(let ([results (doc-index-lookup "print")])
(check-true (for/or ([v (in-list results)])
(match v
[(list "print" "procedure" "racket/base, racket" family
_path _anchor)
(equal? family (if older? "" "Racket"))]
[_ #f])))
(when (rhombus-installed?)
(check-true (for/or ([v (in-list results)])
(match v
[(list "print" kind libs family
_path _anchor)
(and (equal? libs (if older? "(lib rhombus/rx.rhm)" "rhombus/rx"))
(equal? family (if older? "" "Rhombus"))
(equal? kind (if older? "value" "regexp charset operator")))]
[_ #f]))))))

;;; This is for the requires/find command

;; Given some symbol as a string, return the modules providing it,
Expand Down

0 comments on commit 9ee47f6

Please sign in to comment.