aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_pt.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-07-16 11:53:25 -0400
committerNick Mathewson <nickm@torproject.org>2013-07-18 08:43:52 -0400
commitdd18789a9cb5ab5d39c85e3aa4106c020265e6ce (patch)
tree3ad6f871244904c77f922eeeda7efbcf1581a703 /src/test/test_pt.c
parent924946aaafd75a657ae1fd0da95f9e95d19975ca (diff)
downloadtor-dd18789a9cb5ab5d39c85e3aa4106c020265e6ce.tar
tor-dd18789a9cb5ab5d39c85e3aa4106c020265e6ce.tar.gz
Add a unit test for smethod lines with arguments.
Diffstat (limited to 'src/test/test_pt.c')
-rw-r--r--src/test/test_pt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index 16daa2836..6a09807e7 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -91,6 +91,22 @@ test_pt_parsing(void)
reset_mp(mp);
+ /* Include some arguments. Good ones. */
+ strlcpy(line,"SMETHOD trebuchet 127.0.0.1:9999 ARGS:counterweight=3,sling=snappy",
+ sizeof(line));
+ test_assert(parse_smethod_line(line, mp) == 0);
+ tt_int_op(1, ==, smartlist_len(mp->transports));
+ {
+ const transport_t *transport = smartlist_get(mp->transports, 0);
+ tt_assert(transport);
+ tt_str_op(transport->name, ==, "trebuchet");
+ tt_int_op(transport->port, ==, 9999);
+ tt_str_op(fmt_addr(&transport->addr), ==, "127.0.0.1");
+ tt_str_op(transport->extra_info_args, ==,
+ "counterweight=3,sling=snappy");
+ }
+ reset_mp(mp);
+
/* unsupported version */
strlcpy(line,"VERSION 666",sizeof(line));
test_assert(parse_version(line, mp) < 0);