Merge in the docs test into the rest of the scribble tests.
Also fixed it to scan all scrbl files in the docs directory, use runtime-path, and change the rest to racket to get the quoted printout right. original commit: 0801525931be9e9542230091748d366a114cbeb9
This commit is contained in:
commit
abc3822ad4
|
@ -113,7 +113,7 @@
|
|||
#f
|
||||
(map (lambda (l)
|
||||
(list (make-flow (list l))))
|
||||
flow-accum))))))))]
|
||||
(reverse flow-accum)))))))))]
|
||||
[(equal? #\newline v)
|
||||
(loop #f #f (add-line (add-string string-accum line-accum)
|
||||
flow-accum))]
|
||||
|
|
|
@ -468,7 +468,7 @@
|
|||
(loop (cdr flows) (add1 n))]
|
||||
[else n]))])
|
||||
(unless (= cnt 1) (printf "\\multicolumn{~a}{l}{" cnt))
|
||||
(render-table-cell (car flows) part ri twidth (car cell-styles))
|
||||
(render-table-cell (car flows) part ri (/ twidth cnt) (car cell-styles))
|
||||
(unless (= cnt 1) (printf "}"))
|
||||
(unless (null? (list-tail flows cnt)) (printf " &\n"))))
|
||||
(unless (null? (cdr flows)) (loop (cdr flows)
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
[else null]))]
|
||||
[has-hash-lang? (regexp-match? #rx"^#lang " bstr)]
|
||||
[language (if has-hash-lang?
|
||||
(let ([m (regexp-match #rx"^#lang ([-a-zA-Z/._+]+)" bstr)])
|
||||
(let ([m (regexp-match #rx"^#lang ([-0-9a-zA-Z/._+]+)" bstr)])
|
||||
(if m
|
||||
(link-mod
|
||||
#:orig? #t
|
||||
|
|
|
@ -208,7 +208,7 @@ without insetting the code.}
|
|||
@defform[(RACKETRESULTBLOCK0 datum ...)]
|
||||
)]{
|
||||
|
||||
Like @racketblock[racketblock], etc., but colors the typeset text as a
|
||||
Like @racket[racketblock], etc., but colors the typeset text as a
|
||||
result (i.e., a single color with no hyperlinks) instead of code.}
|
||||
|
||||
@deftogether[(
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
The @racketmodname[scribble/srcdoc] and
|
||||
@racketmodname[scribble/extract] libraries support writing
|
||||
documentation withing the documentation code along with an export
|
||||
documentation within the documentation code along with an export
|
||||
contract, similar to using @as-index{JavaDoc}. With this approach, a
|
||||
single contract specification is used both for the run-time contract
|
||||
and the documentation of an exported binding.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang scheme/base
|
||||
#lang racket/base
|
||||
|
||||
(require tests/eli-tester scribble/text/syntax-utils)
|
||||
|
||||
|
|
43
collects/tests/scribble/docs.rkt
Normal file
43
collects/tests/scribble/docs.rkt
Normal file
|
@ -0,0 +1,43 @@
|
|||
#lang racket/base
|
||||
|
||||
;; Use text renderer to check some Scribble functionality
|
||||
|
||||
(require scribble/base-render (prefix-in text: scribble/text-render)
|
||||
racket/file racket/class racket/runtime-path tests/eli-tester)
|
||||
|
||||
(define-runtime-path source-dir "docs")
|
||||
(define work-dir (build-path (find-system-path 'temp-dir)
|
||||
"scribble-docs-tests"))
|
||||
|
||||
(define (build-text-doc src-file dest-file)
|
||||
(let* ([renderer (new (text:render-mixin render%) [dest-dir work-dir])]
|
||||
[docs (list (dynamic-require src-file 'doc))]
|
||||
[fns (list (build-path work-dir dest-file))]
|
||||
[fp (send renderer traverse docs fns)]
|
||||
[info (send renderer collect docs fns fp)]
|
||||
[r-info (send renderer resolve docs fns info)])
|
||||
(send renderer render docs fns r-info)))
|
||||
|
||||
(define (check-text-build src-file expect-file)
|
||||
(build-text-doc src-file "gen.txt")
|
||||
(define (contents file) (regexp-replace #rx"\n+$" (file->string file) ""))
|
||||
(string=? (contents expect-file) (contents (build-path work-dir "gen.txt"))))
|
||||
|
||||
(provide docs-tests)
|
||||
(define (docs-tests)
|
||||
(when (or (file-exists? work-dir) (directory-exists? work-dir))
|
||||
(delete-directory/files work-dir))
|
||||
(make-directory work-dir)
|
||||
(dynamic-wind void
|
||||
(lambda ()
|
||||
(define files (map path-element->string (directory-list source-dir)))
|
||||
(for ([scrbl (in-list files)]
|
||||
#:when (regexp-match? #rx"\\.scrbl$" scrbl)
|
||||
[txt (in-value (regexp-replace #rx"\\.scrbl$" scrbl ".txt"))]
|
||||
#:when (member txt files))
|
||||
;; (printf "Testing ~s -> ~s\n" scrbl txt)
|
||||
(test #:failure-message
|
||||
(format "mismatch from: \"~a\" expected: \"~a\"" scrbl txt)
|
||||
(check-text-build (build-path source-dir scrbl)
|
||||
(build-path source-dir txt)))))
|
||||
(lambda () (delete-directory/files work-dir))))
|
21
collects/tests/scribble/docs/print-lines.scrbl
Normal file
21
collects/tests/scribble/docs/print-lines.scrbl
Normal file
|
@ -0,0 +1,21 @@
|
|||
#lang scribble/manual
|
||||
|
||||
@(require scribble/eval)
|
||||
|
||||
@title{Pretty-Print-Handler Bug Example}
|
||||
|
||||
@(define the-eval (make-base-eval))
|
||||
@(interaction-eval
|
||||
#:eval the-eval
|
||||
(begin
|
||||
(require racket/pretty)
|
||||
(current-print pretty-print-handler)))
|
||||
|
||||
@examples[#:eval the-eval
|
||||
'((x "positional 1")
|
||||
(rest ("positional 2" "positional 3"))
|
||||
(a ())
|
||||
(b ("b-arg"))
|
||||
(c (("first c1" "second c1") ("first c2" "second c2")))
|
||||
(d #f)
|
||||
(e ()))]
|
18
collects/tests/scribble/docs/print-lines.txt
Normal file
18
collects/tests/scribble/docs/print-lines.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
Pretty-Print-Handler Bug Example
|
||||
|
||||
Example:
|
||||
> '((x "positional 1")
|
||||
(rest ("positional 2" "positional 3"))
|
||||
(a ())
|
||||
(b ("b-arg"))
|
||||
(c (("first c1" "second c1") ("first c2" "second c2")))
|
||||
(d #f)
|
||||
(e ()))
|
||||
'((x "positional 1")
|
||||
(rest ("positional 2" "positional 3"))
|
||||
(a ())
|
||||
(b ("b-arg"))
|
||||
(c (("first c1" "second c1") ("first c2" "second c2")))
|
||||
(d #f)
|
||||
(e ()))
|
|
@ -1,7 +1,9 @@
|
|||
#lang scheme/base
|
||||
#lang racket/base
|
||||
|
||||
(require tests/eli-tester "reader.ss" "preprocessor.ss" "collect.ss")
|
||||
(require tests/eli-tester
|
||||
"reader.rkt" "preprocessor.rkt" "collect.rkt" "docs.rkt")
|
||||
|
||||
(test do (reader-tests)
|
||||
do (begin/collect-tests)
|
||||
do (preprocessor-tests))
|
||||
do (preprocessor-tests)
|
||||
do (docs-tests))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#lang scheme/base
|
||||
#lang racket/base
|
||||
|
||||
(require tests/eli-tester scheme/runtime-path scheme/port scheme/sandbox
|
||||
(require tests/eli-tester racket/runtime-path racket/port racket/sandbox
|
||||
(prefix-in doc: (lib "scribblings/scribble/preprocessor.scrbl")))
|
||||
|
||||
(provide preprocessor-tests)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#lang scheme/base
|
||||
#lang racket/base
|
||||
|
||||
(require tests/eli-tester (prefix-in scr: scribble/reader) scheme/list)
|
||||
(require tests/eli-tester (prefix-in scr: scribble/reader) racket/list)
|
||||
|
||||
(provide reader-tests)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user