2 Running Delirium
Delirium can be started from a top-level application or from within a servlet.
2.1 Running Delirium as a top-level application
→ void? | ||||||||||||
start : (request? -> response/c) | ||||||||||||
test : schemeunit-test? | ||||||||||||
run-tests? : boolean? = #t | ||||||||||||
| ||||||||||||
manager : (U manager? #f) = #f | ||||||||||||
port : natural? = 8765 | ||||||||||||
listen-up : (U string? #f) = "127.0.0.1" | ||||||||||||
servlet-path : (U string? #f) = "/" | ||||||||||||
servlet-regexp : (U string? #f) = #rx"" | ||||||||||||
extra-files-paths : (listof path?) = null | ||||||||||||
mime-types-path : (U path? #f) = #f | ||||||||||||
launch-browser? : boolean? = #t | ||||||||||||
|
Wrapper for serve/servlet that sets up sensible defaults for Delirium. All relevant arguments are passed straight through except the following:
if run-tests? is #t, start is wrapped using (make-delirium-controller start test run-tests);
if run-tests? is #t, "/test" is passed on as the value of servlet-path;
if manager, mime-types-path or file-not-found-responder is #fit reverts to its default value in serve/servlet.
2.2 Running Delirium from within a servlet
| ||||||||||||
→ (request? -> response/c) | ||||||||||||
application-controller : (request? -> response/c) | ||||||||||||
test : schemeunit-test? | ||||||||||||
run-tests : procedure? = test/text-ui/pause-on-fail |
Wraps application-controller, creating a controller procedure that runs the Delirium test suite if the URL begins with "/test". All other URLs are passed through to the application.
(run-delirium request test [run-tests]) → response/c |
request : request? |
test : schemeunit-test? |
run-tests : procedure? = test/text-ui/pause-on-fail |
Sends the Delirium test page to the browser and starts running the given test case (which can be a SchemeUnit test suite or test case).
The optional run-tests argument specifies a function to actually run the tests. The default value of run-tests is a version of Schemeunit.plt’s test/text-ui procedure that pauses after each failed test and asks if you wish to continue running tests. This is useful because it allows you to inspect the state of the web page at the point of failure to see what went wrong.