From 9ee47f68fcc3a98a0cc891b848916a81b0e1d1d1 Mon Sep 17 00:00:00 2001 From: Greg Hendershott Date: Fri, 4 Oct 2024 17:44:11 -0400 Subject: [PATCH] Add some basic smoke tests for doc-index-lookup 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. --- racket/scribble.rkt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/racket/scribble.rkt b/racket/scribble.rkt index 7c76b263..6604e650 100644 --- a/racket/scribble.rkt +++ b/racket/scribble.rkt @@ -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,