diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2012-01-19 22:16:11 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2012-01-19 22:16:11 +0000 |
commit | 070c49826c0c483658a81ae52040920fbc7f1069 (patch) | |
tree | a09adfb2dde98b699eef7ea33a01ad4afba35454 /test/basic.c | |
parent | b572d7fca390d18195e0250a15c284feddc8a89f (diff) | |
download | neon-070c49826c0c483658a81ae52040920fbc7f1069.tar.gz |
* src/ne_basic.h: Add NE_CAP_EXT_MKCOL.
* src/ne_basic.c (options_map): Add NE_CAP_EXT_MKCOL.
* test/basic.c (options2): Add test.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1881 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test/basic.c')
-rw-r--r-- | test/basic.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/test/basic.c b/test/basic.c index f149ed4..a0d15ac 100644 --- a/test/basic.c +++ b/test/basic.c @@ -1,6 +1,6 @@ /* Tests for high-level HTTP interface (ne_basic.h) - Copyright (C) 2002-2008, Joe Orton <joe@manyfish.co.uk> + Copyright (C) 2002-2008, 2012, Joe Orton <joe@manyfish.co.uk> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -271,6 +271,52 @@ static int get(void) return OK; } +#define CLASS_12 (NE_CAP_DAV_CLASS1 | NE_CAP_DAV_CLASS2) + +static int options2(void) +{ + static const struct { + const char *hdrs; + unsigned int caps; + } ts[] = { + { "1,2\r\n", CLASS_12 }, + { "1 2\r\n", 0 }, + /* these aren't strictly legal headers: */ + { "2,1\r\n", CLASS_12 }, + { " 1, 2 \r\n", CLASS_12 }, + { "1\r\nDAV:2\r\n", CLASS_12 }, + /* extended types */ + { "1, 2, extended-mkcol", CLASS_12 | NE_CAP_EXT_MKCOL }, + { NULL, 0 } + }; + char resp[BUFSIZ]; + int n; + + for (n = 0; ts[n].hdrs != NULL; n++) { + ne_session *sess; + unsigned int caps; + + ne_snprintf(resp, BUFSIZ, "HTTP/1.0 200 OK\r\n" + "Connection: close\r\n" + "Content-Length: 0\r\n" + "DAV: %s" "\r\n\r\n", ts[n].hdrs); + + CALL(make_session(&sess, single_serve_string, resp)); + + ONREQ(ne_options2(sess, "/foo", &caps)); + + ONV(caps != ts[n].caps, + ("capabilities for 'DAV: %s' were 0x%x, expected 0x%x", + ts[n].hdrs, caps, ts[n].caps)); + + CALL(await_server()); + + ne_session_destroy(sess); + } + + return OK; +} + ne_test tests[] = { T(lookup_localhost), T(content_type), @@ -282,6 +328,7 @@ ne_test tests[] = { T(fail_range_unsatify), T(dav_capabilities), T(get), + T(options2), T(NULL) }; |