1 Introduction
2 Running Delirium
3 Browser API
4 Miscellaneous procedures
On this page:
2.1 Running Delirium from within a servlet
run-delirium
2.2 Delirium/ Instaweb integration
instaweb/ delirium
instaweb/ delirium/ dispatacher
Version: 4.0.1

 

2 Running Delirium

Delirium can be started in one of several ways:

2.1 Running Delirium from within a servlet

(run-delirium request test [run-tests])  response?

  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.

2.2 Delirium/Instaweb integration

 (require (planet untyped/delirium/instaweb))

Provides functions for running Delirium in an analogous manner to Instaweb:

(instaweb/delirium

 

#:test test

 

 

 [

#:servlet-path servlet-path

 

 

 

#:port port

 

 

 

#:listen-ip listen-ip

 

 

 

#:test-url test-url

 

 

 

#:run-tests run-tests

 

 

 

#:htdocs-path htdocs-path

 

 

 

#:servlet-namespace servlet-namespace

 

 

 

#:send-url? send-url?

 

 

 

#:new-window? new-window?])

 

  void?

  test : schemeunit-test?

  servlet-path : (or/c path? string?) = "servlet.ss"

  port : integer? = 8765

  listen-ip : (or/c string? #f) = "127.0.0.1"

  

test-url

 

:

 

url?

 

 

 

=

 

(string->url (format "http://localhost:~a/test" port))

  run-tests : procedure? = test/text-ui/pause-on-fail

  htdocs-path : (or/c path? string?) = instaweb-default

  servlet-namespace : (listof require-spec?) = instaweb-default

  send-url? : boolean = #t

  new-window? : boolean = #t

Constructs a servlet that serves requests to test-url with Delirium and all other requests with files in htdocs-path or the servlet given in servlet-path as per the standard Instaweb rules.

The arguments port, listen-ip, servlet-path, htdocs-path, and servlet-namespace have the same meaning as those for instaweb.

The argument run-tests is the same as for run-delirium.

The argument test-url specifies the URL used to invoke Delirium. By default it is http://localhost:<port>/test.

The argument send-url? determines if a web browser is immediatelydirected to test-url, and new-window? determines if a new window is opened if a web browser is already running.

(instaweb/delirium/dispatacher

 

#:test test

 

 

 

#:app-dispatcher dispatcher

 

 

 [

#:port port

 

 

 

#:listen-ip listen-ip

 

 

 

#:test-url test-url

 

 

 

#:run-tests run-tests

 

 

 

#:htdocs-path htdocs-path

 

 

 

#:send-url? send-url?

 

 

 

#:new-window? new-window?])

 

  void?

  test : schemeunit-test?

  dispatcher : (connection? request? -> void?)

  port : integer? = 8765

  listen-ip : (or/c string? #f) = "127.0.0.1"

  

test-url

 

:

 

url?

 

 

 

=

 

(string->url (format "http://localhost:~a/test" port))

  run-tests : procedure? = test/text-ui/pause-on-fail

  htdocs-path : (or/c path? string?) = instaweb-default

  send-url? : boolean = #t

  new-window? : boolean = #t

To instaweb/dispatcher as delirium/instaweb is to instaweb: Allows you to specify the application part of the program as a dispatcher function rather than a servlet. Useful for testing exotic web applications that are not written as servlets.