From d3c04ae701ab550364d1b6059c78b17434001e48 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 3 May 2011 08:14:51 -0500 Subject: [PATCH] Adjusted docs-complete to print a different message when there are no docs at all and ... ummm... documented docs-complete --- collects/tests/info.rkt | 2 ++ collects/tests/utils/docs-complete.rkt | 40 ++++++++++++++------------ collects/tests/utils/scribblings.scrbl | 31 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 collects/tests/utils/scribblings.scrbl diff --git a/collects/tests/info.rkt b/collects/tests/info.rkt index fb81880f48..242ae01849 100644 --- a/collects/tests/info.rkt +++ b/collects/tests/info.rkt @@ -4,6 +4,8 @@ (define tools '(("time-keystrokes.ss" "drracket"))) (define tool-names '("Time Keystrokes")) +(define scribblings '(("utils/scribblings.scrbl"))) + (define compile-omit-paths '("2htdp" "aligned-pasteboard" diff --git a/collects/tests/utils/docs-complete.rkt b/collects/tests/utils/docs-complete.rkt index 57e95b5c79..97b06fdd05 100644 --- a/collects/tests/utils/docs-complete.rkt +++ b/collects/tests/utils/docs-complete.rkt @@ -84,23 +84,27 @@ ex)) (unless (null? undocumented-exports) - ;; show the undocumented exports from the racket/contract library - (eprintf "~s has undocumented exports:\n" what) - (parameterize ([pretty-print-print-line - (λ (line-num port old-len dest-cols) - (cond - [(not line-num) - (newline port) - 0] - [(equal? line-num 0) - (fprintf port " ") - 2] - [else - (fprintf port "\n ") - 2]))]) - (pretty-write (sort undocumented-exports - stringstring) - (current-error-port))))) + (cond + [(= (length exports) (length undocumented-exports)) + (eprintf "~s has no documented exports\n" what)] + [else + (eprintf "~s has undocumented exports:\n" what) + (parameterize ([pretty-print-print-line + (λ (line-num port old-len dest-cols) + (cond + [(not line-num) + (newline port) + 0] + [(equal? line-num 0) + (fprintf port " ") + 2] + [else + (fprintf port "\n ") + 2]))]) + (pretty-write (sort undocumented-exports + stringstring) + (current-error-port)))]))) (define xref (load-collections-xref)) + diff --git a/collects/tests/utils/scribblings.scrbl b/collects/tests/utils/scribblings.scrbl new file mode 100644 index 0000000000..e850931227 --- /dev/null +++ b/collects/tests/utils/scribblings.scrbl @@ -0,0 +1,31 @@ +#lang scribble/doc + +@(require scribble/manual + (for-label racket)) + +@title{Internal Testing Utilities} + +@section{Checking documentation completeness} +@defmodule[tests/utils/docs-complete] + +@defproc[(check-docs [lib symbol?] + [#:skip skip + (or/c regexp? + symbol? + (listof (or/c regexp? symbol?)) + (-> symbol? any) + #f) + #f]) + any]{ + +Checks to see if the module path named by @racket[lib] (e.g. @racket['racket/list]) +has documented all of its exports and prints an error message to +@racket[(current-error-port)] if not. + +If @racket[skip] is a regexp, then exporting matching that regexp +are ignored. If it is a symbol, then that export is ignored. If +it is a list of symbols and regexps, then any exporting matching any of the +symbols or regexps are ignored. If it is a function, the function is treated +as a predicate and passed each export of the module. If @racket[skip] is +@racket[#f], no exports are skipped. +}