From 4e0988f3a822ef34e275bd5365f3513e406cb167 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 17 Sep 2008 14:19:55 +0000 Subject: [PATCH] preprocessor tests svn: r11787 original commit: ffde7e7b42fdf8d9c085ce3592f025b53e6481d3 --- collects/tests/scribble/main.ss | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/collects/tests/scribble/main.ss b/collects/tests/scribble/main.ss index d5a03073..74233ee5 100644 --- a/collects/tests/scribble/main.ss +++ b/collects/tests/scribble/main.ss @@ -1,6 +1,8 @@ #lang scheme/base -(require tests/eli-tester scribble/text/syntax-utils) +(require tests/eli-tester scribble/text/syntax-utils scheme/runtime-path) + +(define-runtime-path text-dir "text") (test @@ -76,4 +78,17 @@ (f 3 #:> "]" #:< "[")) => '(1 ("<" 1 ">") ("[" 2 ">") ("[" 3 "]")) + ;; preprocessor functionality + (parameterize ([current-directory text-dir]) + (for ([ifile (map path->string (directory-list))] + #:when (and (file-exists? ifile) + (regexp-match? #rx"^i[0-9]+$" ifile))) + (define ofile (regexp-replace #rx"^i" ifile "o")) + (define expected (call-with-input-file ofile + (lambda (i) (read-bytes (file-size ofile) i)))) + (define o (open-output-bytes)) + (parameterize ([current-output-port o]) + (dynamic-require (path->complete-path ifile) #f)) + (test (get-output-bytes o) => expected))) + )