Split and test check messages from check forms
This commit is contained in:
parent
d2af694eb5
commit
8e11af812f
|
@ -23,13 +23,25 @@
|
|||
(string-join (map symbol->string undocumented)
|
||||
"\n")))
|
||||
|
||||
(module+ test
|
||||
(check string=?
|
||||
(check-all-documented-message 'foo 8 '(foo1 foo2 foo3))
|
||||
"Module foo has 8 undocumented bindings:\n\nfoo1\nfoo2\nfoo3"))
|
||||
|
||||
(define-check (check-documented module-name binding)
|
||||
(unless (has-docs? module-name binding)
|
||||
(fail-check
|
||||
(string-append "Module "
|
||||
(symbol->string module-name)
|
||||
" does not document binding "
|
||||
(symbol->string binding)))))
|
||||
(fail-check (check-documented-message module-name binding))))
|
||||
|
||||
(define (check-documented-message module-name binding)
|
||||
(string-append "Module "
|
||||
(symbol->string module-name)
|
||||
" does not document binding "
|
||||
(symbol->string binding)))
|
||||
|
||||
(module+ test
|
||||
(check string=?
|
||||
(check-documented-message 'foo 'foo1)
|
||||
"Module foo does not document binding foo1"))
|
||||
|
||||
(define-check (check-documentation-ratio module-name minimum-ratio)
|
||||
(let ([actual-ratio (module-documentation-ratio module-name)])
|
||||
|
@ -41,4 +53,18 @@
|
|||
(number->string (exact->inexact (* 100 minimum-ratio)))
|
||||
"% of its bindings, only documents "
|
||||
(number->string (exact->inexact (* 100 actual-ratio)))
|
||||
"%")))))
|
||||
"%")))))
|
||||
|
||||
(define (check-documentation-ratio-message module-name minimum-ratio actual-ratio)
|
||||
(string-append "Module "
|
||||
(symbol->string module-name)
|
||||
" does not document at least "
|
||||
(number->string (exact->inexact (* 100 minimum-ratio)))
|
||||
"% of its bindings, only documents "
|
||||
(number->string (exact->inexact (* 100 actual-ratio)))
|
||||
"%"))
|
||||
|
||||
(module+ test
|
||||
(check string=?
|
||||
(check-documentation-ratio-message 'foo 0.5 0.25)
|
||||
"Module foo does not document at least 50.0% of its bindings, only documents 25.0%"))
|
Loading…
Reference in New Issue
Block a user