Verified Commit c1301f87 authored by Camil Staps's avatar Camil Staps 🙂

Add ability to disable tests; add a test

parent ba6a4042
......@@ -137,6 +137,8 @@ fs.readdir('tests', function(err, files) {
var failed = 0;
for (var i in files) {
if (files[i].indexOf('.disabled') != -1)
continue;
var contents = fs.readFileSync(path.join('tests', files[i])).toString();
var testcase = parseTestCase(files[i], contents);
if (runTestCase(testcase))
......
TypeDef
-----
:: WebService r w =
{ urlMatchPred :: !(String -> Bool) // checks whether the URL is served by this service
, completeRequest :: !Bool // wait for complete request before start serving request
, onNewReq :: !(HTTPRequest r *IWorld -> *(!HTTPResponse,!Maybe ConnectionState, !Maybe w, !*IWorld)) // is called for each new request
, onData :: !(HTTPRequest r String ConnectionState *IWorld -> *(![{#Char}], !Bool, !ConnectionState, !Maybe w, !*IWorld)) // on new data from client
, onShareChange :: !(HTTPRequest r ConnectionState *IWorld -> *(![{#Char}], !Bool, !ConnectionState, !Maybe w, !*IWorld)) // on shared change
, onTick :: !(HTTPRequest r ConnectionState *IWorld -> *(![{#Char}], !Bool, !ConnectionState, !Maybe w, !*IWorld)) // called on each iteration of main loop
, onDisconnect :: !(HTTPRequest r ConnectionState *IWorld -> *(!Maybe w, !*IWorld)) // is called on disconnect
}
-----
punctuation ::
whitespace
type WebService
whitespace
typevar r
whitespace
typevar w
whitespace
punctuation =
whitespace \n
punctuation {
whitespace
field urlMatchPred
whitespace
punctuation ::
whitespace
punctuation !(
type String
whitespace
punctuation ->
whitespace
type Bool
punctuation )
whitespace
comment // checks whether the URL is served by this service
whitespace \n
punctuation ,
whitespace
field completeRequest
whitespace
punctuation ::
whitespace
punctuation !
type Bool
whitespace
comment // wait for complete request before start serving request
whitespace \n
punctuation ,
whitespace
field onNewReq
whitespace
punctuation ::
whitespace
punctuation !(
type HTTPRequest
whitespace
typevar r
whitespace
punctuation *
type IWorld
whitespace
punctuation ->
whitespace
punctuation *(!
type HTTPResponse
punctuation ,!
type Maybe
whitespace
type ConnectionState
punctuation ,
whitespace
punctuation !
type Maybe
whitespace
typevar w
punctuation ,
whitespace
punctuation !*
type IWorld
punctuation ))
whitespace
comment // is called for each new request
whitespace \n
punctuation ,
whitespace
field onData
whitespace
punctuation ::
whitespace
punctuation !(
type HTTPRequest
whitespace
typevar r
whitespace
type String
whitespace
type ConnectionState
whitespace
punctuation *
type IWorld
whitespace
punctuation ->
whitespace
punctuation *(![{#
type Char
punctuation }],
whitespace
punctuation !
type Bool
punctuation ,
whitespace
punctuation !
type ConnectionState
punctuation ,
whitespace
punctuation !
type Maybe
whitespace
typevar w
punctuation ,
whitespace
punctuation !*
type IWorld
punctuation ))
whitespace
comment // on new data from client
whitespace \n
punctuation ,
whitespace
field onShareChange
whitespace
punctuation ::
whitespace
punctuation !(
type HTTPRequest
whitespace
typevar r
whitespace
type ConnectionState
whitespace
punctuation *
type IWorld
whitespace
punctuation ->
whitespace
punctuation *(![{#
type Char
punctuation }],
whitespace
punctuation !
type Bool
punctuation ,
whitespace
punctuation !
type ConnectionState
punctuation ,
whitespace
punctuation !
type Maybe
whitespace
typevar w
punctuation ,
whitespace
punctuation !*
type IWorld
punctuation ))
whitespace
comment // on shared change
whitespace \n
punctuation ,
whitespace
field onTick
whitespace
punctuation ::
whitespace
punctuation !(
type HTTPRequest
whitespace
typevar r
whitespace
type ConnectionState
whitespace
punctuation *
type IWorld
whitespace
punctuation ->
whitespace
punctuation *(![{#
type Char
punctuation }],
whitespace
punctuation !
type Bool
punctuation ,
whitespace
punctuation !
type ConnectionState
punctuation ,
whitespace
punctuation !
type Maybe
whitespace
typevar w
punctuation ,
whitespace
punctuation !*
type IWorld
punctuation ))
whitespace
comment // called on each iteration of main loop
whitespace \n
punctuation ,
whitespace
field onDisconnect
whitespace
punctuation ::
whitespace
punctuation !(
type HTTPRequest
whitespace
typevar r
whitespace
type ConnectionState
whitespace
punctuation *
type IWorld
whitespace
punctuation ->
whitespace
punctuation *(!
type Maybe
whitespace
typevar w
punctuation ,
whitespace
punctuation !*
type IWorld
punctuation ))
whitespace
comment // is called on disconnect
whitespace \n
punctuation }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment