[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Improve coverage on esc_for_log, esc_for_log_len
commit 6dc2b605b878e590d7dc3478d71fd5a4ba0af118
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
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 mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits