(use test irregex intarweb spiffy uri-common) (load "../ssp-handler") ;; Change this to (use spiffy-ssp-handler) when compiling tests (load "../web-scheme-handler") ;; Change this to (use web-scheme-handler) when compiling tests (import ssp-handler web-scheme-handler) (test-begin "spiffy-dynamic-handlers") (include "testlib.scm") (parameterize ((file-extension-handlers `(("ssp" . ,ssp-handler) ("ws" . ,web-scheme-handler)))) (start-spiffy)) (test-begin "ssp-handler") (test-response "Basic test" (200 "Hello, there\nThis is from SSP!\n") "/ssp/dynamic.ssp") (test-response "Ssp-include test" (200 "Next up, we include some other file:\nHi,\nI just got included\nOK, I'm out\n\nGot it?\n") "/ssp/include-ssp.ssp") (test-response "Mixed content" (200 "This is some mixed content\n") "/ssp/mixed.ssp") (test-response "Non-ssp text file is not interpreted" (200 (read-all "./testweb/ssp/uninterpreted.txt")) "/ssp/uninterpreted.txt") (test-response "Non-ssp HTML file is not interpreted" (200 (read-all "./testweb/ssp/static.html")) "/ssp/static.html") ;; Note the missing newline at the end of the file; it gets eaten by the "?>" glyph (test-response "ssp-stringize" (200 "This gets the input \"Hi,\\nI just got included\\nOK, I'm out\\n\" as a string and uses it") "/ssp/ssp-stringize.ssp") (test-response "Early exit" (200 "This line, we see\nThis one, too\n") "/ssp/exit.ssp") (test-end) ;; This is not complete enough yet. TODO: Write tests for environments support (test-begin "web-scheme-handler") (test-response "Displayed string (void return)" (200 "Hi\nthis is a basic test.") "/web-scheme/basic.ws") (test-response "Returned string" (200 "Hello, there\nThis is from Web-Scheme!\n") "/web-scheme/string.ws") (test-end) (test-end) (test-exit)