Roxen.git/
server/
etc/
test/
tests/
http/
RoxenTest_websockets.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2018-09-27
2018-09-27 10:13:44 by Henrik Grubbström (Grubba) <grubba@grubba.org>
ed560b44a83b8c8826c5c88ea831d21bc71f663c (
53
lines) (+
53
/-
0
)
[
Show
|
Annotate
]
Branch:
agehall/websocket
Testsuite
[WebSockets]
: Enabled the websocket testsuite.
1:
+
inherit "../pike_async_process_test_common";
-
+
+
string simple_check( )
+
{
+
return
+
common_wait( ([ 2:"Illegal headers",
+
3:"Illegal data",
+
4:"Connection failed",
+
5:"Bad protocol value in reply",
+
6:"Bad response code in reply",
+
7:"No date header",
+
8:"Bad or no content-length header",
+
9:"Bad or no last-modified header",
+
11:"Did not expect headers",
+
12:"Did not expect data",
+
13:"Did not expect connection",
+
14:"Did not expect valid reply",
+
]) );
+
}
+
+
function run( string script, string file, int|string ... ma )
+
{
+
return lambda() {
+
run_pikescript( script, file, @((array(string))ma) );
+
};
+
}
+
+
#define rtest( COMMENT, SCRIPT, PATH, ARGS...) \
+
atest(COMMENT, run(SCRIPT, FILE, ARGS), simple_check)
+
+
// NB: Keep in sync with the brokeness enum in websocket.pike.
+
constant descriptions = ({
+
"Trivial",
+
"Bad path",
+
"Bad path suffix",
+
"Bad HTTP version",
+
"No Connection header",
+
"Bad Connection header",
+
"No Upgrade header",
+
"Bad Upgrade header",
+
"No Sec-WebSocket-Version header",
+
"Bad Sec-WebSocket-Version header",
+
"No Sec-WebSocket-Key header",
+
"Bad Sec-WebSocket-Key header",
+
});
+
+
void setup( )
+
{
+
foreach(descriptions; int i; string descr) {
+
rtest(descr, "http/websocket.pike", "/websocket_example/", i, descr);
+
}
+
}
Newline at end of file added.