commit 6dc2b605b878e590d7dc3478d71fd5a4ba0af118 Author: Nick Mathewson nickm@torproject.org Date: Thu Jun 16 09:58:53 2016 -0400
Improve coverage on esc_for_log, esc_for_log_len --- src/test/test_util.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/src/test/test_util.c b/src/test/test_util.c index abb400c..c643fea 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1586,6 +1586,17 @@ test_util_strmisc(void *arg) tt_str_op(""z\001abc\277d"",OP_EQ, escaped("z\001abc\277d")); tt_str_op(""z\336\255 ;foo"",OP_EQ, escaped("z\xde\xad\x20;foo"));
+ /* Other cases of esc_for_log{,_len} */ + cp_tmp = esc_for_log(NULL); + tt_str_op(cp_tmp, OP_EQ, "(null)"); + tor_free(cp_tmp); + cp_tmp = esc_for_log_len("abcdefg", 3); + tt_str_op(cp_tmp, OP_EQ, ""abc""); + tor_free(cp_tmp); + cp_tmp = esc_for_log_len("abcdefg", 100); + tt_str_op(cp_tmp, OP_EQ, ""abcdefg""); + tor_free(cp_tmp); + /* Test strndup and memdup */ { const char *s = "abcdefghijklmnopqrstuvwxyz";
tor-commits@lists.torproject.org