summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-06 21:01:52 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-06 21:01:52 -0400
commit3823d0aa7d2a3ea4c21610c111aa199f75ace107 (patch)
tree666de6224935fe2862e0a8e1dc9cc67d978da22b /src/test/test_util.c
parentd09723ad19b1f292d31a3f52d8ef8052c8ece309 (diff)
downloadtor-3823d0aa7d2a3ea4c21610c111aa199f75ace107.tar.gz
tor-3823d0aa7d2a3ea4c21610c111aa199f75ace107.zip
Capture and detect the BUG() warnings in test_util_parse_integer.
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 974caeef05..3fd2dc3612 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -1974,10 +1974,20 @@ test_util_parse_integer(void *arg)
tt_int_op(1,OP_EQ, i);
tt_str_op(cp,OP_EQ, " plus garbage");
/* Illogical min max */
+ tor_capture_bugs_(1);
tt_int_op(0L,OP_EQ, tor_parse_long("10",10,50,4,&i,NULL));
tt_int_op(0,OP_EQ, i);
+ tt_int_op(1, OP_EQ, smartlist_len(tor_get_captured_bug_log_()));
+ tt_str_op("!(max < min)", OP_EQ,
+ smartlist_get(tor_get_captured_bug_log_(), 0));
+ tor_end_capture_bugs_();
+ tor_capture_bugs_(1);
tt_int_op(0L,OP_EQ, tor_parse_long("-50",10,100,-100,&i,NULL));
tt_int_op(0,OP_EQ, i);
+ tt_int_op(1, OP_EQ, smartlist_len(tor_get_captured_bug_log_()));
+ tt_str_op("!(max < min)", OP_EQ,
+ smartlist_get(tor_get_captured_bug_log_(), 0));
+ tor_end_capture_bugs_();
/* Out of bounds */
tt_int_op(0L,OP_EQ, tor_parse_long("10",10,50,100,&i,NULL));
tt_int_op(0,OP_EQ, i);
@@ -2061,7 +2071,7 @@ test_util_parse_integer(void *arg)
tt_int_op(i,OP_EQ, 0);
}
done:
- ;
+ tor_end_capture_bugs_();
}
static void