Avoid duplicating code in test files.

This commit is contained in:
Eli Barzilay 2013-07-06 23:38:33 -04:00
parent 31fbce7e5a
commit 62fc516c24
13 changed files with 26 additions and 14 deletions

View File

@ -25,5 +25,5 @@
(module+ main
(tcp-localhost-available?))
(module+ test
(tcp-localhost-available?))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -9,7 +9,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(putenv "REQUEST_METHOD" "GET")
(test (test-bindings 'amp-or-semi "key1=value1&key2=value2;key3=value3")
@ -22,3 +21,5 @@
=> '([key1 . "value1"] [key2 . "value2"])
(test-bindings 'semi "key1=value1&key2=value2")
=> '([key1 . "value1&key2=value2"])))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -5,7 +5,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
;; cookie-test : (cookie -> cookie) string -> test
(define (cookie-test fn expected)
@ -97,3 +96,5 @@
)
(test do (tests)))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -99,9 +99,10 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(test do (internal-tests)
(nameserver-tests *google-dns*)
(nameserver-tests *google-dns-2*)
(let ([ns (dns-find-nameserver)]) (when ns (nameserver-tests ns)))))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -70,7 +70,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(test
do (check-same-all (lambda (i o) (qp-encode-stream i o))
@ -109,3 +108,5 @@ Use this to compare base64 encode/decode against the unix utilities
(and (equal? en (base64-encode* bstr))
(equal? (base64-decode en) (base64-decode* en)))))
|#
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -33,7 +33,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(define cop (open-output-string))
(define-values [pasv1-thd pasv1-port] (tcp-serve* (current-output-port) DIRLIST))
@ -280,3 +279,5 @@
RNTO test2
QUIT
@||})
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -5,7 +5,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(define test-header
(string-append "From: abc\r\nTo: field is\r\n continued\r\n"
@ -93,3 +92,5 @@
=> #"From: abc\r\nTo: field is\r\n continued\r\nAnother: zoo\r\n continued\r\nAthird: data\r\n\r\n"
))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -9,7 +9,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(test
;; ----------------------------------------
@ -124,3 +123,5 @@
(not ((bytes-of-length 5) "moogle"))
;; ----------------------------------------
))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -35,7 +35,6 @@ EOS
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(define analyzed (mime-analyze ip))
(define our-entity (message-entity analyzed))
@ -60,3 +59,5 @@ EOS
(open-input-string "Content-Type: multipart/mixed\r\n\r\n"))
=error> missing-multipart-boundary-parameter?
))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -3,7 +3,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(define sepmode current-alist-separator-mode)
(test (uri-decode "%Pq") => "%Pq"
@ -147,3 +146,5 @@
=> '([key1 . "value 1"] [key2 . "value 2"])
))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -123,7 +123,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(test
(run-tests "http" values #f)
@ -133,3 +132,5 @@
(lambda (in out)
(ports->ssl-ports in out #:mode 'accept #:context ctx)))
#t)))
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -45,7 +45,6 @@
(provide tests)
(module+ main (test do (tests)))
(module+ test (test do (tests)))
(define (tests)
(test
;; Test the current-proxy-servers parameter can be set
@ -379,3 +378,5 @@
))
)
(module+ test (require (submod ".." main))) ; for raco test & drdr

View File

@ -13,7 +13,6 @@
(provide tests)
(module+ main (tests))
(module+ test (tests))
(define (tests)
(test
(for ([i (in-range RANDOM-K)])
@ -94,3 +93,5 @@
(parameterize ([framing-mode 'old]) (test-echo-server))
#:failure-prefix "new"
(parameterize ([framing-mode 'new]) (test-echo-server)))))))
(module+ test (require (submod ".." main))) ; for raco test & drdr