diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-06-16 09:58:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-06-16 09:58:53 -0400 |
commit | 6dc2b605b878e590d7dc3478d71fd5a4ba0af118 (patch) | |
tree | 6df7afbb796b643d3451a84b024105e179a1c9ee /src/test/test_util.c | |
parent | d1ab295d7b2c4c8bd3da5e1774bc352f8cfe72ab (diff) | |
download | tor-6dc2b605b878e590d7dc3478d71fd5a4ba0af118.tar.gz tor-6dc2b605b878e590d7dc3478d71fd5a4ba0af118.zip |
Improve coverage on esc_for_log, esc_for_log_len
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index abb400cbe0..c643fead16 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"; |